Skip to content

Commit 1636407

Browse files
authored
Merge pull request #14376 from anntzer/inlayout
Simplify removal of figure patch from bbox calculations.
2 parents 150faa1 + 26ffec1 commit 1636407

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/matplotlib/figure.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,10 @@ def __init__(self,
363363
self.transFigure = BboxTransformTo(self.bbox)
364364

365365
self.patch = Rectangle(
366-
xy=(0, 0), width=1, height=1,
366+
xy=(0, 0), width=1, height=1, visible=frameon,
367367
facecolor=facecolor, edgecolor=edgecolor, linewidth=linewidth,
368-
visible=frameon)
368+
# Don't let the figure patch influence bbox calculation.
369+
in_layout=False)
369370
self._set_artist_props(self.patch)
370371
self.patch.set_antialiased(False)
371372

@@ -2339,9 +2340,6 @@ def get_default_bbox_extra_artists(self):
23392340
for ax in self.axes:
23402341
if ax.get_visible():
23412342
bbox_artists.extend(ax.get_default_bbox_extra_artists())
2342-
# we don't want the figure's patch to influence the bbox calculation
2343-
if self.patch in bbox_artists:
2344-
bbox_artists.remove(self.patch)
23452343
return bbox_artists
23462344

23472345
def get_tightbbox(self, renderer, bbox_extra_artists=None):

0 commit comments

Comments
 (0)