matplotlib.figure.Figure — Matplotlib 3.10.1 documentation (original) (raw)

class matplotlib.figure.Figure(figsize=None, dpi=None, *, facecolor=None, edgecolor=None, linewidth=0.0, frameon=None, subplotpars=None, tight_layout=None, constrained_layout=None, layout=None, **kwargs)[source]#

The top level container for all the plot elements.

See matplotlib.figure for an index of class methods.

Attributes:

patch

The Rectangle instance representing the figure background patch.

suppressComposite

For multiple images, the figure will make composite images depending on the renderer option_image_nocomposite function. If_suppressComposite_ is a boolean, this will override the renderer.

Parameters:

figsize2-tuple of floats, default: [rcParams["figure.figsize"]](../../users/explain/customizing.html?highlight=figure.figsize#matplotlibrc-sample) (default: [6.4, 4.8])

Figure dimension (width, height) in inches.

dpifloat, default: [rcParams["figure.dpi"]](../../users/explain/customizing.html?highlight=figure.dpi#matplotlibrc-sample) (default: 100.0)

Dots per inch.

facecolordefault: [rcParams["figure.facecolor"]](../../users/explain/customizing.html?highlight=figure.facecolor#matplotlibrc-sample) (default: 'white')

The figure patch facecolor.

edgecolordefault: [rcParams["figure.edgecolor"]](../../users/explain/customizing.html?highlight=figure.edgecolor#matplotlibrc-sample) (default: 'white')

The figure patch edge color.

linewidthfloat

The linewidth of the frame (i.e. the edge linewidth of the figure patch).

frameonbool, default: [rcParams["figure.frameon"]](../../users/explain/customizing.html?highlight=figure.frameon#matplotlibrc-sample) (default: True)

If False, suppress drawing the figure background patch.

subplotparsSubplotParams

Subplot parameters. If not given, the default subplot parameters [rcParams["figure.subplot.*"]](../../users/explain/customizing.html?highlight=figure.subplot.%2A#matplotlibrc-sample) are used.

tight_layoutbool or dict, default: [rcParams["figure.autolayout"]](../../users/explain/customizing.html?highlight=figure.autolayout#matplotlibrc-sample) (default: False)

Whether to use the tight layout mechanism. See set_tight_layout.

Discouraged

The use of this parameter is discouraged. Please uselayout='tight' instead for the common case oftight_layout=True and use set_tight_layout otherwise.

constrained_layoutbool, default: [rcParams["figure.constrained_layout.use"]](../../users/explain/customizing.html?highlight=figure.constrained%5Flayout.use#matplotlibrc-sample) (default: False)

This is equal to layout='constrained'.

Discouraged

The use of this parameter is discouraged. Please uselayout='constrained' instead.

layout{'constrained', 'compressed', 'tight', 'none', LayoutEngine, None}, default: None

The layout mechanism for positioning of plot elements to avoid overlapping Axes decorations (labels, ticks, etc). Note that layout managers can have significant performance penalties.

If not given, fall back to using the parameters tight_layout and_constrained_layout_, including their config defaults[rcParams["figure.autolayout"]](../../users/explain/customizing.html?highlight=figure.autolayout#matplotlibrc-sample) (default: False) and [rcParams["figure.constrained_layout.use"]](../../users/explain/customizing.html?highlight=figure.constrained%5Flayout.use#matplotlibrc-sample) (default: False).

Other Parameters:

**kwargsFigure properties, optional