0

I have been trying to get a bar plot with value labels on each bar. I have searched all over but can't get this done. My df is the one below.

Pillar                       % 
Exercise                    19.4
Meaningful Activity         19.4
Sleep                        7.7
Nutrition                   22.9
Community                   16.2
Stress Management           23.9

My code so far is

df_plot.plot(x ='Pillar', y='%', kind = 'bar')
plt.show()
Ray92
  • 347
  • 3
  • 16

1 Answers1

2

Use ax.bar_label:

ax = df.plot(x='Pillar', y='%', kind='bar', legend=False, rot=0)
ax.bar_label(ax.containers[0], label_type='edge')
plt.tight_layout()

bar with values

Corralien
  • 70,617
  • 7
  • 16
  • 36