I am using matplotlib with python 2.7
I need to create a simple pyplot bar chart, and for every bar, I need to add, on top of it, the y value of it.
I am creating a bar chart with the following code:
import matplotlib.pyplot as plt
barlist = plt.bar([0,1,2,3], [100,200,300,400], width=5)
barlist[0].set_color('r')
barlist[0].title("what?!")
the changing of color works, but for the title i get the following error: AttributeError: 'Rectangle' object has no attribute 'title'
i found some questions about similar question but they are not using the same way of creating a bar chart, and their solution did not work for me.
any ideas for a simple solution for adding the values of the bars as titles above them?
thanks!