8000 DOC: fix API note about get_tightbbox · matplotlib/matplotlib@9d2c9fb · GitHub
[go: up one dir, main page]

Skip to content

Commit 9d2c9fb

Browse files
committed
DOC: fix API note about get_tightbbox
1 parent 5758fc8 commit 9d2c9fb

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

doc/api/api_changes.rst

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,26 +70,34 @@ returned *image* now is of type `~.matplotlib.collections.QuadMesh`
7070
instead of `~.matplotlib.image.AxesImage`.
7171

7272

73-
`.matplotlib.Axes.get_tightbbox` now includes all artists
74-
---------------------------------------------------------
73+
`.matplotlib.axes.Axes.get_tightbbox` now includes all artists
74+
--------------------------------------------------------------
75+
76+
For Matplotlib 3.0, *all* artists are now included in the bounding box
77+
returned by `.matplotlib.axes.Axes.get_tightbbox`.
78+
79+
`.matplotlib.axes.Axes.get_tightbbox` adds a new kwarg ``bbox_extra_artists``
80+
to specify the manually list of artists on the axes to include in the
81+
tight bounding box calculation.
7582

7683
Layout tools like `.Figure.tight_layout`, ``constrained_layout``,
7784
and ``fig.savefig('fname.png', bbox_inches="tight")`` use
78-
`.matplotlib.Axes.get_tightbbox` to determine the bounds of each axes on
85+
`.matplotlib.axes.Axes.get_tightbbox` to determine the bounds of each axes on
7986
a figure and adjust spacing between axes.
8087

8188
In Matplotlib 2.2 ``get_tightbbox`` started to include legends made on the
8289
axes, but still excluded some other artists, like text that may overspill an
83-
axes. For Matplotlib 3.0, *all* artists are now included in the bounding box.
90+
axes. This has been expanded to include *all* artists.
8491

85-
This new default may be overridden in either of two ways:
92+
This new default may be overridden in either of three ways:
8693

8794
1. Make the artist to be excluded a child of the figure, not the axes. E.g.,
8895
call ``fig.legend()`` instead of ``ax.legend()`` (perhaps using
89-
`~.matplotlib.Axes.get_legend_handles_labels` to gather handles and labels
90-
from the parent axes).
96+
`~.matplotlib.axes.Axes.get_legend_handles_labels` to gather handles and
97+
labels from the parent axes).
9198
2. If the artist is a child of the axes, set the artist property
9299
``artist.set_in_layout(False)``.
100+
3. Manually specify a list of artists in the new kwarg ``bbox_extra_artists``.
93101

94102

95103
`Text.set_text` with string argument ``None`` sets string to empty

0 commit comments

Comments
 (0)
0