@@ -69,6 +69,34 @@ which will improve the handling of log-axes. Note that the
69
69
returned *image * now is of type `~.matplotlib.collections.QuadMesh `
70
70
instead of `~.matplotlib.image.AxesImage `.
71
71
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 ``.
72
100
73
101
`.matplotlib.Axes.get_tightbbox ` now includes all artists
74
102
---------------------------------------------------------
0 commit comments