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

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -