1

I have seen this post regarding ggplot2: How to automatically adjust the width of each facet for facet_wrap?

I was wondering:

how can I achieve the same in plotnine? I haven't found anything similar to grob. I would need it for a plot that is part of a python3 pipeline so I really don't want to convert part of the code to R.

Thanks for the help!

schmat_90
  • 572
  • 3
  • 22

1 Answers1

1

I checked the post you linked and proposed a far simpler solution, which is to use facet_grid rather than facet_wrap. When you use facet_grid, you can specify space='free' to automatically adjust the size of the facets, rather than the size of the scales only with scales=. There does not appear to be an option with facet_wrap to specify space= (only scales=).

I do not have direct experience using plotnine, but a quick check here shows that there exists a similar function that includes both space= and scales= arguments.

chemdork123
  • 12,369
  • 2
  • 16
  • 32