1

I hope nobody asked the question already, but I couldn’t find anything online despite it seems like a straightforward problem.

Using Seaborns FacetGrid, I created a plot that looks appealing when I maximize the plot window but cluttered when keeping the default window size. That’s why I would like to scale the plot to a larger size (similar to what happens when clicking on the maximize button on the plot window) when saving the figure programmatically. I haven’t found anything in the documentation to change the width and height of the FacetGrid in the way I‘d like to. The only parameters I found that affect the shown figure where „size“ and „aspect“, but I can’t set them in a way to look like what I get when maximizing the window manually…

I feel like this is a stupid question that should be easy to solve but so far I couldn’t come up with anything.

Bobipuegi
  • 521
  • 1
  • 4
  • 11
  • 1
    The size of the figure is set by providing the `height` of each facet, along with the `aspect` ratio. These are parameters that you need to provide to [`FacetGrid`](https://seaborn.pydata.org/generated/seaborn.FacetGrid.html#seaborn.FacetGrid). From the docs: `height` in inches of each facet; `aspect` ratio of each facet, so that `aspect * height` gives the width of each facet in inches. – Alex Dec 03 '21 at 13:10
  • See also [How to maximize plt show window](https://stackoverflow.com/questions/12439588/how-to-maximize-a-plt-show-window-using-python) – JohanC Dec 03 '21 at 13:21
  • thank you ; @Alex that is exactly my problem. I can change the size of the facets, but not of the figure overall. That’s why changes to the figure (e.g. adding a suptitle) don’t scale nicely. – Bobipuegi Dec 03 '21 at 13:52
  • Thank you too @JohanC ; your tip works to maximizing the shown window, but savefig() seems to be unaffected. The created figures are still saved in the too small default size – Bobipuegi Dec 03 '21 at 13:54
  • 1
    You can use `g.figure.set_size_inches(20, 12)` to change the size, e.g. just before saving. – JohanC Dec 03 '21 at 14:17
  • Thank you! It was g.fig.set_size_inches(), but now it looks like it should be. – Bobipuegi Dec 03 '21 at 14:20

0 Answers0