@@ -59,6 +59,34 @@ which will improve the handling of log-axes. Note that the
59
59
returned *image * now is of type `~.matplotlib.collections.QuadMesh `
60
60
instead of `~.matplotlib.image.AxesImage `.
61
61
62
+ `.matplotlib.axes.Axes.get_tightbbox ` now includes all artists
63
+ --------------------------------------------------------------
64
+
65
+ For Matplotlib 3.0, *all * artists are now included in the bounding box
66
+ returned by `.matplotlib.axes.Axes.get_tightbbox `.
67
+
68
+ `.matplotlib.axes.Axes.get_tightbbox ` adds a new kwarg ``bbox_extra_artists ``
69
+ to specify the manually list of artists on the axes to include in the
70
+ tight bounding box calculation.
71
+
72
+ Layout tools like `.Figure.tight_layout `, ``constrained_layout ``,
73
+ and ``fig.savefig('fname.png', bbox_inches="tight") `` use
74
+ `.matplotlib.axes.Axes.get_tightbbox ` to determine the bounds of each axes on
75
+ a figure and adjust spacing between axes.
76
+
77
+ In Matplotlib 2.2 ``get_tightbbox `` started to include legends made on the
78
+ axes, but still excluded some other artists, like text that may overspill an
79
+ axes. This has been expanded to include *all * artists.
80
+
81
+ This new default may be overridden in either of three ways:
82
+
83
+ 1. Make the artist to be excluded a child of the figure, not the axes. E.g.,
84
+ call ``fig.legend() `` instead of ``ax.legend() `` (perhaps using
85
+ `~.matplotlib.axes.Axes.get_legend_handles_labels ` to gather handles and
86
+ labels from the parent axes).
87
+ 2. If the artist is a child of the axes, set the artist property
88
+ ``artist.set_in_layout(False) ``.
89
+ 3. Manually specify a list of artists in the new kwarg ``bbox_extra_artists ``.
62
90
63
91
`Text.set_text ` with string argument ``None `` sets string to empty
64
92
------------------------------------------------------------------
0 commit comments