Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions doc/api/api_changes_3.3/deprecations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,11 @@ replaced by calls to ``draw_idle()`` on the corresponding canvas.
The ``add_checker`` and ``check_update`` methods and ``update_dict`` attribute
of `.ScalarMappable` are deprecated.

``ColorbarBase`` parameters will become keyword-only
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All parameters of ``ColorbarBase``, except for the first (*ax*), will become
keyword-only, consistently with ``Colorbar``.
`.pyplot.tight_layout` and ``ColorbarBase`` parameters will become keyword-only
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All parameters of `.pyplot.tight_layout` and all parameters of ``ColorbarBase``
except for the first (*ax*) will become keyword-only, consistently with
`.Figure.tight_layout` and ``Colorbar``, respectively.

`.Axes.pie` radius and startangle
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
15 changes: 7 additions & 8 deletions lib/matplotlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -2414,7 +2414,7 @@ def execute_constrained_layout(self, renderer=None):
def tight_layout(self, renderer=None, pad=1.08, h_pad=None, w_pad=None,
rect=None):
"""
Automatically adjust subplot parameters to give specified padding.
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),
Expand All @@ -2424,16 +2424,15 @@ def tight_layout(self, renderer=None, pad=1.08, h_pad=None, w_pad=None,
----------
renderer : subclass of `~.backend_bases.RendererBase`, optional
Defaults to the renderer for the figure. Deprecated.
pad : float, optional
pad : float, default: 1.08
Padding between the figure edge and the edges of subplots,
as a fraction of the font size.
h_pad, w_pad : float, optional
h_pad, w_pad : float, default: *pad*
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).
as a fraction of the font size.
rect : tuple (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.

See Also
--------
Expand Down
15 changes: 8 additions & 7 deletions lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1328,22 +1328,23 @@ def subplot_tool(targetfig=None):
return SubplotTool(targetfig, toolfig)


# After deprecation elapses, this can be autogenerated by boilerplate.py.
@cbook._make_keyword_only("3.3", "pad")
def tight_layout(pad=1.08, h_pad=None, w_pad=None, rect=None):
"""
Automatically adjust subplot parameters to give specified padding.
Adjust the padding between and around subplots.

Parameters
----------
pad : float
pad : float, default: 1.08
Padding between the figure edge and the edges of subplots,
as a fraction of the font size.
h_pad, w_pad : float, optional
h_pad, w_pad : float, default: *pad*
Padding (height/width) between edges of adjacent subplots,
as a fraction of the font size. Defaults to *pad*.
as a fraction of the font size.
rect : tuple (left, bottom, right, top), default: (0, 0, 1, 1)
A rectangle (left, bottom, right, top) in the normalized
figure coordinate that the whole subplots area (including
labels) will fit into.
A rectangle in normalized figure coordinates into which the whole
subplots area (including labels) will fit.
"""
gcf().tight_layout(pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect)

Expand Down