I want to use a subscript in a matplotlib legend.
The code looks like:
for i in np.arange(10):
plt.plot(xdata, ydata, label='$P_i$')
This would give me ten times the legend item P_i
I want to read out the value of i for each iteration of the loop, such that I would get a legend like P_1, P_2, P_3, ...
I already found this thread in stackoverflow, but it didn't give me the result I want; it produced subscripts properly, but not with a changing index.
Thank you, lepakk