plot
Matplotlib automatic legend outside plot [duplicate]
EDIT: I HIGHLY RECOMMEND USING THE ANSWER FROM ImportanceOfBeingErnest: How to put the legend outside the plot EDIT END This one is easier to understand: import matplotlib.pyplot as plt x = [1,2,3] plt.subplot(211) plt.plot(x, label=”test1″) plt.plot([3,2,1], label=”test2″) plt.legend(bbox_to_anchor=(0, 1), loc=”upper left”, ncol=1) plt.show() now play with the to coordinates (x,y). For loc you can use: … Read more
savefig loop adds previous plots to figure
You have to close current figure after saving with function plt.close(): http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.close Or you have to clean current figure after saving by plt.clf(): http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.clf
How to change the order of lines in a Matlab figure?
If you know the handle of line you want on top (e.g. because you called h = plot(…), you can use uistack uistack(h,’top’) Alternatively, you can manipulate the order of children of your current axes directly. The following puts the last-most curve on top. chH = get(gca,’Children’) set(gca,’Children’,[chH(end);chH(1:end-1)])
Using a Pandas dataframe index as values for x-axis in matplotlib plot
It seems the issue was that I had .values. Without it (i.e. site2.index) the graph displays correctly.