I have an index array (x) of dates (datetime objects) and an array of actual values (y: bond prices). Doing the following:
plot(x,y)
produces a perfectly fine time series graph with the x-axis labeled with the dates. No problem so far. But I want to add text on certain dates. For example, on 2009-10-31, I wish to display the text "Event 1" with an arrow pointing to the y value at that date.
I have read through the Matplotlib documentation on text() and annotate() to no avail.
xy=('2009-5-1',3)
in the above example and it works. Tested on matplotlib 2.2.2. jakevdp.github.io/PythonDataScienceHandbook/… – Amphictyony