I have a matplotlib graph that I have created using data from arrays. I want to annotate this graph at certain points. The x axis is populated with dates (14/06/12, 15/06/12) etc.. The y axis is price (6500, 6624) etc... I would like to annotate at point: for example (x,y) (14/06/12, 6500). This is my code so far:
Date = ["14/06/12", "15/06/12"]
Open = [6500, 6544]
High = [5434, 5234]
Low = [5342, 5325]
Close = [4523, 2342]
ohlc = []
i = 0
while i < 2:
Prices = Date[i], Open[i], High[i], low[i], Close[i]
ohlc.append(Prices)
i += 1
candlestick_ohlc(ax, ohlc, width=0.8, colorup='g', colordown='r')
ax.xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m-%d'))
ax.annotate('Here!', xy=(Date[1], Price[1]))
plt.show()
This is the current graph and I want the annotation on it where i put it: https://i.sstatic.net/5qM4D.jpg
Pricesis and whatohlcis exactly? I'm not a matplotlib person, but if someone wanted to assist here and wanted to test out your code, I would assume it would be helpful to give a small sample of the data.subplotsto perform this annotation? I'm looking at the documentation on annotation examples here: matplotlib.org/users/annotations_intro.html#annotating-text