python - Subplots grid, legend outside, savefig does not work -
i have same problem guy here, want put legend outside plot, savefig not work. additionally, working subplots environment. let me phrase problem here general possible:
fig, axarr = plt.subplots(n,m) #... (plotting)... axarr[k,l].legend(loc=(x,y)) # x , y such outside of plot plt.savefig("test.pdf")
by way, me keyword 'bbox_inches' not work.
you can try may work
lgd = axarr[k,l].legend(loc=(x,y)) # x , y such outside of plot plt.savefig("test.pdf", bbox_inches='tight', bbox_extra_artists=(lgd,))
Comments
Post a Comment