Primary
matplotlib.figure.Figure() ⚬|Documentation|1st|20251021001434-00-⌔
matplotlib.figure.Figure — Matplotlib 3.10.8 documentation#matplotlib.figure.Figure
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)The top level container for all the plot elements.
See
matplotlib.figurefor an index of class methods.Attributes:
patch
The
Rectangleinstance 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:
figsize: (float, float) or (float, float, str), default:rcParams["figure.figsize"](default:[6.4, 4.8])The figure dimensions. This can be
- a tuple
(width, height, unit), where unit is one of “in” (inch), “cm” (centimenter), “px” (pixel).- a tuple
(width, height), which is interpreted in inches, i.e. as(width, height, "in").One of width or height may be
None; the respective value is taken fromrcParams["figure.figsize"](default:[6.4, 4.8]).
dpi: float, default:rcParams["figure.dpi"](default:100.0)Dots per inch.
facecolor: default:rcParams["figure.facecolor"](default:'white')The figure patch facecolor.
edgecolor: default:rcParams["figure.edgecolor"](default:'white')The figure patch edge color.
linewidth: floatThe linewidth of the frame (i.e. the edge linewidth of the figure patch).
frameon: bool, default:rcParams["figure.frameon"](default:True)If
False, suppress drawing the figure background patch.
subplotpars:SubplotParamsSubplot parameters. If not given, the default subplot parameters
rcParams["figure.subplot.﹡"]are used.
tight_layout: bool or dict, default:rcParams["figure.autolayout"](default:False)Whether to use the tight layout mechanism. See
set_tight_layout.Discouraged: The use of this parameter is discouraged. Please use
layout='tight'instead for the common case oftight_layout=Trueand useset_tight_layoutotherwise.
constrained_layout: bool, default:rcParams["figure.constrained_layout.use"](default:False)This is equal to
layout='constrained'.Discouraged: The use of this parameter is discouraged. Please use
layout='constrained'instead.
layout: {‘constrained’, ‘compressed’, ‘tight’, ‘none’,LayoutEngine, None}, default: NoneThe layout mechanism for positioning of plot elements to avoid overlapping Axes decorations (labels, ticks, etc). Note that layout managers can have significant performance penalties.
- ‘constrained’: The constrained layout solver adjusts Axes sizes to avoid overlapping Axes decorations. Can handle complex plot layouts and colorbars, and is thus recommended. See Constrained layout guide for examples.
- ‘compressed’: uses the same algorithm as ‘constrained’, but removes extra space between fixed-aspect-ratio Axes. Best for simple grids of Axes.
- ‘tight’: Use the tight layout mechanism. This is a relatively simple algorithm that adjusts the subplot parameters so that decorations do not overlap. See Tight layout guide for examples.
- ‘none’: Do not use a layout engine.
- A
LayoutEngineinstance. Builtin layout classes areConstrainedLayoutEngineandTightLayoutEngine, more easily accessible by ‘constrained’ and ‘tight’. Passing an instance allows third parties to provide their own layout engine.If not given, fall back to using the parameters tight_layout and constrained_layout, including their config defaults
rcParams["figure.autolayout"](default:False) andrcParams["figure.constrained_layout.use"](default:False).Other Parameters:
﹡﹡kwargs:Figureproperties, optionalPrinted 2026-06-28.
Link to original
Secondary
• • •