If I plot a DataFrame as
df.plot()
then each line appears in the legend identifying which column it corresponds to, as it should be. However, if I plot it as
df.plot(x=0, y=[2,3])
then everything is plotted normally, however there is no legend identifying which line is which column.
I have tried
df.plot(x=0, y=[2,3], label=['2','3'])
df.plot(x=0, y=[2,3], legend=['2','3'])
but nothing works. The only workaround is to set
plt.legend(['2','3'])
afterwards, but I am not sure that the order of the legend list is the same order that pandas uses for plotting, so I don't know if the legend really matches the lines. Is there a way to make pandas plot the legend is this case?
I am using pandas 0.14.
y=[2,3]? If so, the current version of pandas, 0.17, works as expected -- a legend is produced using, for example,df = pd.DataFrame(np.random.random((10,4))),df.plot(x=0, y=[2,3]).