matplotlib.figure.Figure.subfigures#

Figure.subfigures(nrows=1,ncols=1,squeeze=True,wspace=None,hspace=None,width_ratios=None,height_ratios=None,**kwargs)[source]#

Add a set of subfigures to this figure or subfigure.

A subfigure has the same artist methods as a figure, and is logicallythe same as a figure, but cannot print itself.SeeFigure subfigures.

Changed in version 3.10:subfigures are now added in row-major order.

Parameters:
nrows, ncolsint, default: 1

Number of rows/columns of the subfigure grid.

squeezebool, default: True

If True, extra dimensions are squeezed out from the returnedarray of subfigures.

wspace, hspacefloat, default: None

The amount of width/height reserved for space between subfigures,expressed as a fraction of the average subfigure width/height.If not given, the values will be inferred from rcParams if usingconstrained layout (seeConstrainedLayoutEngine), or zero ifnot using a layout engine.

width_ratiosarray-like of lengthncols, optional

Defines the relative widths of the columns. Each column gets arelative width ofwidth_ratios[i]/sum(width_ratios).If not given, all columns will have the same width.

height_ratiosarray-like of lengthnrows, optional

Defines the relative heights of the rows. Each row gets arelative height ofheight_ratios[i]/sum(height_ratios).If not given, all rows will have the same height.

Examples usingmatplotlib.figure.Figure.subfigures#

Figure subfigures

Figure subfigures

Text rotation mode

Text rotation mode

Tick formatters

Tick formatters

Arranging multiple Axes in a Figure

Arranging multiple Axes in a Figure

Axis ticks

Axis ticks

Constrained layout guide

Constrained layout guide

Complex and semantic figure composition (subplot_mosaic)

Complex and semantic figure composition (subplot_mosaic)