Home > database >  Use a list with Matplotlib bar_label() in order to label bar
Use a list with Matplotlib bar_label() in order to label bar

Time:09-23

Currently, I'm using the bar_label() new feature from Matplotlib v3.4.0.

My code is as follow and works perfectly :

ax.bar_label(ax.containers[0])

However, I would like to use different values as label. These values are available in a list.

I tried :

ax.bar_label(my_list)

But it doesn't work.

Is there any way to use bar_label() with a custom list ?

CodePudding user response:

As mentionned in the comment by BigBen, labels parameter is the good thing to use.

Be careful to use also container (both are working together !)

  • Related