Removes all tight_layout calls
Matplotlib offers constrained layouts:
https://matplotlib.org/stable/tutorials/intermediate/constrainedlayout_guide.html
which performs better than tight layouts:
https://github.com/matplotlib/cheatsheets/issues/30#issuecomment-655594205
At the same time, tight layout is known to trigger certain bugs. For example:
https://github.com/matplotlib/ipympl/issues/335
Here we remove all call to tight_layout in the toolbox. @carinanc @mercurio
Merge request reports
Activity
assigned to @mercadil
Sound good, but by default, constrained layouts is False in the rcParams. Should we make sure that it is set to True before plotting? Otherwise it forces the users to add a line in the notebook to set it up, which may often be forgotten. Or should we specifically change from tight_layout to constrained_layout in the code?
Right now we have a potential bug that breaks the code. With this change, in the worst case, we get figures not as pretty as they could be.
We could add
constrained_layout=True
in all calls tofigure
andsubplots
. I'm not sure it's the best, considering that constrained layout are still experimental. But then I've been using them all the time.What do you prefer ?
Edited by Loïc Le Guyader
added 1 commit
- d5cdd5b7 - Introduce matplotlib constrained layout in doc
mentioned in commit 6e126fa8