Plot.layout(*, size=<default>, engine=<default>)#

Control the figure size and layout.


Default figure sizes and the API for specifying the figure size are subject to change in future “experimental” releases of the objects API. The default layout engine may also change.

size(width, height)

Size of the resulting figure, in inches. Size is inclusive of legend when using pyplot, but not otherwise.

engine{{“tight”, “constrained”, None}}

Name of method for automatically adjusting the layout to remove overlap. The default depends on whether Plot.on() is used.


Control the overall dimensions of the figure with size:

p = so.Plot().layout(size=(4, 4))

Subplots created by using Plot.facet() or Plot.pair() will shrink to fit in the available space:

p.facet(["A", "B"], ["X", "Y"])

You may find that different automatic layout engines give better or worse results with specific plots:

p.facet(["A", "B"], ["X", "Y"]).layout(engine="constrained")