Figures have a layout_engine property that holds a subclass of
LayoutEngine defined here (or None for no layout). At draw time
figure.get_layout_engine().execute() is called, the goal of which is
usually to rearrange Axes on the figure to produce a pleasing layout. This is
like a draw callback but with two differences. First, when printing we
disable the layout engine for the final draw. Second, it is useful to know the
layout engine while the figure is being created. In particular, colorbars are
made differently with different layout engines (for historical reasons).
Fraction of the figure to dedicate to space between the
axes. These are evenly spread between the gaps between the Axes.
A value of 0.2 for a three-column layout would have a space
of 0.1 of the figure width between each column.
If h/wspace < h/w_pad, then the pads are used instead.
Default to (default: ) and
(default: ).
propertyadjust_compatible
Return a boolean if the layout engine is compatible with
subplots_adjust.
propertycolorbar_gridspec
Return a boolean if the layout engine creates colorbars using a
gridspec.
execute(fig)
Perform constrained_layout and move and resize Axes accordingly.
A layout engine can be passed to a figure at instantiation or at any time
with set_layout_engine. Once attached to a figure, the
layout engine execute function is called at draw time by
draw, providing a special draw-time hook.
Currently, there are two properties of LayoutEngine classes that are
consulted while manipulating the figure:
engine.colorbar_gridspec tells Figure.colorbar whether to make the
This layout engine does not adjust the figure layout at all.
The purpose of this LayoutEngine is to act as a placeholder when the user removes
a layout engine to ensure an incompatible LayoutEngine cannot be set later.
Parameters:
adjust_compatible, colorbar_gridspec : bool
Allow the PlaceHolderLayoutEngine to mirror the behavior of whatever
layout engine it is replacing.
propertyadjust_compatible
Return a boolean if the layout engine is compatible with
subplots_adjust.
propertycolorbar_gridspec
Return a boolean if the layout engine creates colorbars using a
gridspec.
execute(fig)
Do nothing.
get()
Return copy of the parameters for the layout engine.
Fraction of the figure to dedicate to space between the
axes. These are evenly spread between the gaps between the Axes.
A value of 0.2 for a three-column layout would have a space
of 0.1 of the figure width between each column.
If h/wspace < h/w_pad, then the pads are used instead.
Default to rcParams["figure.constrained_layout.hspace"] (default: 0.02) and
rcParams["figure.constrained_layout.wspace"] (default: 0.02).
rect : tuple of 4 floats
Rectangle in figure coordinates to perform constrained layout in
(left, bottom, width, height), each from 0-1.
Figure.subplots_adjust
run if it is not compatible with the layout engine.