1

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()
Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
Ray92
  • 439
  • 6
  • 18

1 Answers1

5

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
  • 109,409
  • 8
  • 28
  • 52