Figure¶
- class Figure(tight=None, ref=1, outerpad=None, innerpad=None, panelpad=None, includepanels=False, span=None, spanx=None, spany=None, align=None, alignx=None, aligny=None, share=None, sharex=None, sharey=None, gridspec_kw=None, subplots_kw=None, subplots_orig_kw=None, mathtext_fallback=None, **kwargs)[source]¶
Bases:
matplotlib.figure.FigureThe
Figureclass returned bysubplots. At draw-time, an improved tight layout algorithm is employed, and the space around the figure edge, between subplots, and between panels is changed to accommodate subplot content. Figure dimensions may be automatically scaled to preserve subplot aspect ratios.- Parameters
tight (bool, optional) – Toggles automatic tight layout adjustments. Default is
rc[‘subplots.tight’]=True. If you manually specified a spacing in the call tosubplots, it will be used to override the tight layout spacing. For example, withleft=0.1, the left margin is set to 0.1 inches wide, while the remaining margin widths are calculated automatically.ref (int, optional) – The reference subplot number. See
subplotsfor details. Default is1.outerpad (float or str, optional) – Padding around edge of figure. Units are interpreted by
units. Default isrc[‘subplots.outerpad’]='0.5em'.innerpad (float or str, optional) – Padding between subplots in adjacent columns and rows. Units are interpreted by
units. Default isrc[‘subplots.innerpad’]='1em'.panelpad (float or str, optional) – Padding between subplots and axes panels, and between “stacked” panels. Units are interpreted by
units. Default isrc[‘subplots.panelpad’]='0.5em'.includepanels (bool, optional) – Whether to include panels when centering x axis labels, y axis labels, and figure “super titles” along the edge of the subplot grid. Default is
False.sharex, sharey, share ({3, 2, 1, 0}, optional) – The “axis sharing level” for the x axis, y axis, or both axes. Default is
rc[‘subplots.share’]=3. Options are as follows:No axis sharing. Also sets the default
spanxandspanyvalues toFalse.Only draw axis label on the leftmost column (y) or bottommost row (x) of subplots. Axis tick labels still appear on every subplot.
As in 1, but forces the axis limits to be identical. Axis tick labels still appear on every subplot.
As in 2, but only show the axis tick labels on the leftmost column (y) or bottommost row (x) of subplots.
spanx, spany, span (bool or {0, 1}, optional) – Toggles “spanning” axis labels for the x axis, y axis, or both axes. Default is
Falseifsharex,sharey, orshareare0,rc[‘subplots.span’]=Trueotherwise. WhenTrue, a single, centered axis label is used for all axes with bottom and left edges in the same row or column. This can considerably redundancy in your figure.“Spanning” labels integrate with “shared” axes. For example, for a 3-row, 3-column figure, with
sharey > 1andspany=1, your figure will have 1 ylabel instead of 9.alignx, aligny, align (bool or {0, 1}, optional) – Whether to align axis labels for the x axis, y axis, or both axes. Only has an effect when
spanx,spany, orspanareFalse. Default isrc[‘subplots.align’]=False.mathtext_fallback (bool or str, optional) – Figure-specific application of the
rc[‘mathtext.fallback’]property. IfTrueor string, unavailable glyphs are replaced with a glyph from a fallback font (Computer Modern by default). Otherwise, they are replaced with the “¤” dummy character. See this mathtext tutorial for details.gridspec_kw, subplots_kw, subplots_orig_kw – Keywords used for initializing the main gridspec, for initializing the figure, and original spacing keyword args used for initializing the figure that override tight layout spacing.
- Other Parameters
**kwargs – Passed to
matplotlib.figure.Figure.
Attributes Summary
The x axis label alignment mode.
The y axis label alignment mode.
The single
GridSpecinstance used for all subplots in the figure.The reference axes number.
The x axis sharing level.
The y axis sharing level.
The x axis label spanning mode.
The y axis label spanning mode.
Whether subplot spacing is determined automatically for spaces that were not explicitly fixed by the user.
Methods Summary
auto_layout([renderer, resize, aspect, tight])Trigger proplot’s automatic figure size and tight layout algorithm.
colorbar(mappable[, values, loc, width, …])Draw a colorbar along the left, right, bottom, or top side of the figure, centered between the leftmost and rightmost (or topmost and bottommost) main axes.
legend([handles, labels, loc, width, space, …])Draw a legend along the left, right, bottom, or top side of the figure, centered between the leftmost and rightmost (or topmost and bottommost) main axes.
save(filename, **kwargs)Alias for
savefig.