Legend text can be a little annoying because if you’re plotting multiple series, they could have similar labels that need to be disambiguated. The secret to setting legend text in Matplotlib is to create the whole object, then call plt.legend with the text that you want as arguments. Alternatively, you could set the ‘label’ argument for each of the series that you plot. Another consideration is that there may be some data series that you don’t want to include, which is best handled with the legend object itself.
Here’s an example of a legend being set, drawn from the Matplotlib Time Series article:
ax.legend((ax.lines,ax.lines), ('Retweets per Day','Retweets per Day (Linear Regression)'), loc='upper left',fontsize=15)
It’s important to remember that legend placement is also mutable, so you might want to fiddle with that as well.