Open jklymak opened 4 years ago
The reason is that I did not know about constrained_layout
... What's the difference with tight_layout
?
Simply speaking: Constrained layout does a better layouting job in many cases.
From constrained layout guide:
constrained_layout is similar to tight_layout, but uses a constraint solver to determine the size of axes that allows them to fit.
But that's only the technical implementation. @jklymak I don't think we have an explanation what that means for the user. Would be nice to add a sentence to the constrained layout guide as well.
constrained layout works with multi-axes colorbars, it makes axes match size whether they have colorbars or not, it works with nested gridspecs. It works with uneven subplot layouts (i.e. 2 axes in one column, and 3 axes in another column). It also works interactively - i.e. when the axes is resized, which I don't think tight_layout does. Overall, I think most users want constrained_layout versus tight_layout - I'm not aware of situations where tight_layout is better, but happy for reports.
And is possible to remove white margins in the process? (like pdfcrop
does)
Sure if you set hpad and wpad to zero.
https://github.com/matplotlib/cheatsheets/blob/329e0ba94d06c2a9f6af4600af9a25dcac6d9f5a/handout-tips.tex#L215 calls out
tight_layout
in particular. Is there a reason to not also call outconstrained_layout
? In generalconstrained_layout
is more "automatic".