Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
|
|
|
| 442 |
if width < min_width:
|
| 443 |
width = min_width
|
| 444 |
-
ax.text(width - 0.02, bar.get_y() + bar.get_height()/2, f'{
|
| 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
|