Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 75ec309

Browse filesBrowse files
authored
Merge pull request #12205 from meeseeksmachine/auto-backport-of-pr-12186-on-v3.0.x
Backport PR #12186 on branch v3.0.x (DOC: fix API note about get_tightbbox)
2 parents 1b07227 + a866fa1 commit 75ec309
Copy full SHA for 75ec309

File tree

Expand file treeCollapse file tree

1 file changed

+28
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+28
-0
lines changed

‎doc/api/api_changes.rst

Copy file name to clipboardExpand all lines: doc/api/api_changes.rst
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,34 @@ which will improve the handling of log-axes. Note that the
6969
returned *image* now is of type `~.matplotlib.collections.QuadMesh`
7070
instead of `~.matplotlib.image.AxesImage`.
7171

72+
`.matplotlib.axes.Axes.get_tightbbox` now includes all artists
73+
--------------------------------------------------------------
74+
75+
For Matplotlib 3.0, *all* artists are now included in the bounding box
76+
returned by `.matplotlib.axes.Axes.get_tightbbox`.
77+
78+
`.matplotlib.axes.Axes.get_tightbbox` adds a new kwarg ``bbox_extra_artists``
79+
to manually specify the list of artists on the axes to include in the
80+
tight bounding box calculation.
81+
82+
Layout tools like `.Figure.tight_layout`, ``constrained_layout``,
83+
and ``fig.savefig('fname.png', bbox_inches="tight")`` use
84+
`.matplotlib.axes.Axes.get_tightbbox` to determine the bounds of each axes on
85+
a figure and adjust spacing between axes.
86+
87+
In Matplotlib 2.2 ``get_tightbbox`` started to include legends made on the
88+
axes, but still excluded some other artists, like text that may overspill an
89+
axes. This has been expanded to include *all* artists.
90+
91+
This new default may be overridden in either of three ways:
92+
93+
1. Make the artist to be excluded a child of the figure, not the axes. E.g.,
94+
call ``fig.legend()`` instead of ``ax.legend()`` (perhaps using
95+
`~.matplotlib.axes.Axes.get_legend_handles_labels` to gather handles and
96+
labels from the parent axes).
97+
2. If the artist is a child of the axes, set the artist property
98+
``artist.set_in_layout(False)``.
99+
3. Manually specify a list of artists in the new kwarg ``bbox_extra_artists``.
72100

73101
`.matplotlib.Axes.get_tightbbox` now includes all artists
74102
---------------------------------------------------------

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.