You are reading documentation for the unreleased version of Matplotlib. Try searching for the released version of this page instead?
Applications are open for the 2018 John Hunter Matplotlib Summer Fellowship. Apply now!
Version 2.2.2.post1752+g4b1f956cb
matplotlib
Fork me on GitHub

Table Of Contents

matplotlib.pyplot.tight_layout

matplotlib.pyplot.tight_layout(pad=1.08, h_pad=None, w_pad=None, rect=None)[source]

Automatically adjust subplot parameters to give specified padding.

Parameters:
pad : float

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

h_pad, w_pad : float, optional

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

rect : tuple (left, bottom, right, top), optional

A rectangle (left, bottom, right, top) in the normalized figure coordinate that the whole subplots area (including labels) will fit into. Default is (0, 0, 1, 1).