matplotlib.figure.Figure.tight_layout#

Figure.tight_layout(*, pad=1.08, h_pad=None, w_pad=None, rect=None)[source]#

Adjust the padding between and around subplots.

To exclude an artist on the Axes from the bounding box calculation that determines the subplot parameters (i.e. legend, or annotation), set a.set_in_layout(False) for that artist.

Parameters:
padfloat, default: 1.08

Padding between the figure edge and the edges of subplots, as a fraction of the font size.

h_pad, w_padfloat, default: pad

Padding (height/width) between edges of adjacent subplots, as a fraction of the font size.

recttuple (left, bottom, right, top), default: (0, 0, 1, 1)

A rectangle in normalized figure coordinates into which the whole subplots area (including labels) will fit.

Examples using matplotlib.figure.Figure.tight_layout#

Filling the area between lines

Filling the area between lines

Hat graph

Hat graph

Marker reference

Marker reference

Scatter Demo2

Scatter Demo2

Contour Image

Contour Image

Creating annotated heatmaps

Creating annotated heatmaps

pcolor images

pcolor images

pcolormesh

pcolormesh

QuadMesh Demo

QuadMesh Demo

Triinterp Demo

Triinterp Demo

Equal axis aspect ratio

Equal axis aspect ratio

Resizing Axes with tight layout

Resizing Axes with tight layout

Combining two subplots using subplots and GridSpec

Combining two subplots using subplots and GridSpec

Creating multiple subplots using plt.subplots

Creating multiple subplots using plt.subplots

Plots with different scales

Plots with different scales

Demo of the histogram function's different histtype settings

Demo of the histogram function's different histtype settings

The histogram (hist) function with multiple data sets

The histogram (hist) function with multiple data sets

Accented text

Accented text

Mathtext

Mathtext

Drawing fancy boxes

Drawing fancy boxes

Log Demo

Log Demo

Logit Demo

Logit Demo

Exploring normalizations

Exploring normalizations

Symlog Demo

Symlog Demo

Bar demo with units

Bar demo with units

Radian ticks

Radian ticks

Unit handling

Unit handling

PGF fonts

PGF fonts

PGF texsystem

PGF texsystem

Tight layout guide

Tight layout guide

Choosing Colormaps in Matplotlib

Choosing Colormaps in Matplotlib