0

I read through this post, because my plots keep cutting off the legend in the interactive matplotlib window. The solution for saving figures using plt.savefig(bbox_extra_artists=(legend,)) to include additional artists outside the axes works great, but the open window seems to follow a different set of rules. My question is, if there's a way to do the same for the interactive window, because the solution in the post above didn't work for me and just using fig.canvas._tkcanvas.master.geometry(ipythonWindowSize) streches the plot to the new canvas size. Is there no straighforward way to just provide the legend of a plot to the plt.show() call like for plt.savefig() so it doesn't get cut off in the interactive window? The only other way I could think of is to make a gridspec and display the legend in it's own seperate axes.

I don't use any plt.subplots_adjust() calls in my script, I just set the figsize when creating the figure using plt.subplots().

My code is pretty long and complex so I hope the references to the post above and a screenshot will suffice to explain what the issue is.The draggable legend gets cut off from in the open window

J.Doe
  • 224
  • 1
  • 4
  • 19
  • Check [how-to-put-the-legend-out-of-the-plot](https://stackoverflow.com/a/43439132/4124317). If you want to stick with your current font size, you obviously will *need* to make the figure wider. `.subplots_adjust()` can be used to gain more space for the legend, such that it will not be cropped. – ImportanceOfBeingErnest Mar 10 '20 at 02:06
  • Can I determine the value I need to provide to ```.subplots_adjust()``` based on the legend's size so I can do ```.subplots_adjust(top=val)```? – J.Doe Mar 10 '20 at 02:36
  • Possible options: [here](https://stackoverflow.com/a/47540409/4124317), [here](https://stackoverflow.com/a/55272871/4124317), [here](https://stackoverflow.com/a/43001737/4124317) – ImportanceOfBeingErnest Mar 10 '20 at 20:24

0 Answers0