I want to have the legend handles as strings.
e.g. I create a plot using:
fig = plt.figure()
ax = plt.subplot(111)
values = [1, 2, 3, 4]
plt.plot(values, marker = '+')
plt.ylim(0,5)
for i,v in enumerate(values):
ax.annotate(str(v), xy=(i,v), xytext=(-10, 10), textcoords='offset points', fontsize = 12, color = 'r')
plt.show()
Now, I want a legend having handles and labels as
handles = ['1', '2', '3', '4']
labels = ['a', 'b', 'c', 'd']
but
plt.legend(handles = handles, labels= labels)
doesn't work. Any insight would be appreciated. Thanks!