Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tight_layout versus constrained_layout #30

Open
jklymak opened this issue Jul 7, 2020 · 5 comments
Open

tight_layout versus constrained_layout #30

jklymak opened this issue Jul 7, 2020 · 5 comments

Comments

@jklymak
Copy link
Member

jklymak commented Jul 7, 2020

Once your figure is finished, you can call {\ttfamily tight\_layout()}
calls out tight_layout in particular. Is there a reason to not also call out constrained_layout? In general constrained_layout is more "automatic".

@rougier
Copy link
Member

rougier commented Jul 8, 2020

The reason is that I did not know about constrained_layout... What's the difference with tight_layout?

@timhoffm
Copy link
Member

timhoffm commented Jul 8, 2020

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.

@jklymak
Copy link
Member Author

jklymak commented Jul 8, 2020

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.

@rougier
Copy link
Member

rougier commented Jul 8, 2020

And is possible to remove white margins in the process? (like pdfcrop does)

@jklymak
Copy link
Member Author

jklymak commented Jul 8, 2020

Sure if you set hpad and wpad to zero.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants