From 3574e73cf04faeb8743d9b0f75970f83dc102c28 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Tue, 5 Oct 2021 21:44:10 +0200 Subject: [PATCH] Clarify FigureBase.tight_bbox as different from all other artists. It explicitly scales the union of child tightbboxes by 1/dpi, i.e. converts from pixels to inches. Perhaps that's not the most elegant design, but let's make that behavior clear. --- lib/matplotlib/figure.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index dee0de8c5691..8b6420535e61 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -1596,7 +1596,10 @@ def get_default_bbox_extra_artists(self): def get_tightbbox(self, renderer, bbox_extra_artists=None): """ - Return a (tight) bounding box of the figure in inches. + Return a (tight) bounding box of the figure *in inches*. + + Note that `.FigureBase` differs from all other artists, which return + their `.Bbox` in pixels. Artists that have ``artist.set_in_layout(False)`` are not included in the bbox.