I have a bar chart in Python on which I want to plot some other values (representing, for example the average values) as segments.
Consider the following code which plots a simple bar chart:
import matplotlib.pyplot as plt
h = plt.bar([0,1,2], [4,5,6],width=0.5)
plt.legend((h,), ("vals",))
plt.show()
This plots the following image:
For each bar, I have an average value that I want to plot over the corresponding bar as a segment. The desired plot is something like the following:
How can I plot values over bars as segments in matplotlib?


