Say that I am plotting a very basic step plot with this code:
import matplotlib.pyplot as plt
x = [1, 2, 3, 4, 5, 6]
y = [0.5, 0.22, 0.75, 1, 0.9, 1.2]
text = ['H', 'F', 'E', 'F', 'IT', 'M']
plt.step(x, y,'k-', where='post')
plt.show()
How can I display on the top of each lines or bar, the text
list? So between x=1 and x=2
on the top of the bar, have 'H'
, then between x=2 and x=3
, have 'F'
, and so on...