Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
As a follow on to#19892
Currently we have two layout engines, and#19892 proposes to access them with afigure(layout='constrained'/'tight')
kwarg and to discourageconstrained_layout=True
andtight_layout=True
.
As a follow up, it would be good to create a new base classclass Layout
(orFigureLayout
) that has subclassesclass ConstrainedLayout
andclass TightLayout
but could also have more, and/or user-defined subclasses. This would improve option handling:figure(layout=ConstrainedLayout(wspace=0.2))
instead of passing a hard-to-document dict.
The parent would probably need an__init__
and anexecute
method, and probably a bunch of setters for the various settings.
This would give us scope to define more layout engines or light wrappers around the existing ones. For instance, a frequently asked one, which is in proplot, is to have an inside-out layout where the axes sizes are fixed and the figure grows or shrinks to accommodate.
This would make the layout manager hot swappable as well, if it only did all its work at draw.
This would also remove state fromFigure
andGridspec
, though it would add state back toFigure
in thefig._layout
parameter. To implement, we would add toFigure.draw()
:
ifself._layoutisnotNone:self._layout.execute()