I have made a scatter plot by using variable=plt.scatter(test1,test2)
where test1
and test2
are lists corresponding to x and y.
Is there a way to annotate each point with a list of strings or variable color, that I have created?
I have found that:
for i, txt in enumerate(variablelabel):
variable.annotate(txt, (test1[i],test2[i]))
where variablelabel
is defined as my list of strings. Unfortunately, this does not seem to annotate my scatter plot.
Alternatively, I have found you can add arrows using this similar code:
ax.annotate('local max', xy=(2, 1), xytext=(3, 1.5),
arrowprops=dict(facecolor='black', shrink=0.05),
ax.set_ylim(-2,2)
plt.show()
But this creates large arrows which I do not want. I only want strings from my list.
Sorry if I'm not being very clear.