Reputation: 3984
I'm used to this syntax when plotting multiple lines:
plt.plot(freqs,ps,freqs,psf)
I tried different variations of label=["ps","psf"]
in it, using different kind of parentheses, but I was always unable to obtain a correct legend
Upvotes: 1
Views: 141
Reputation: 6065
plt.plot
will return a list of handles for the lines. You can pass those to legend
, along with a list of labels:
handles=plt.plot([0,1],[5,6],[0,1],[8,7])
plt.legend(handles,["label a","label b"])
Upvotes: 2