tonyliu404 commited on
Commit
f4f3de7
·
verified ·
1 Parent(s): 2a7e086

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -438,10 +438,11 @@ if recipe_submit and uploaded_image:
438
  min_width = 0.07 * ax.get_xlim()[1] # 7% of the x-axis range
439
  # Add labels inside the bars, aligned to the right
440
  for bar in bars:
441
- width = bar.get_width()
 
442
  if width < min_width:
443
  width = min_width
444
- ax.text(width - 0.02, bar.get_y() + bar.get_height()/2, f'{width:.2f}%',
445
  va='center', ha='right', color='white', fontweight='bold', fontsize=14)
446
 
447
  ax.set_xticklabels([]) #remove x label
 
438
  min_width = 0.07 * ax.get_xlim()[1] # 7% of the x-axis range
439
  # Add labels inside the bars, aligned to the right
440
  for bar in bars:
441
+ original_width = bar.get_width()
442
+ width = original_width
443
  if width < min_width:
444
  width = min_width
445
+ ax.text(width - 0.02, bar.get_y() + bar.get_height()/2, f'{original_width:.1f}%',
446
  va='center', ha='right', color='white', fontweight='bold', fontsize=14)
447
 
448
  ax.set_xticklabels([]) #remove x label