Skip to content

Commit 619baed

Browse files
authored
Merge pull request #14375 from meeseeksmachine/auto-backport-of-pr-14374-on-v3.1.x
Backport PR #14374 on branch v3.1.x (Check that the figure patch is in bbox_artists before trying to remove.)
2 parents 6075ec8 + fbbede3 commit 619baed

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/matplotlib/figure.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2329,7 +2329,8 @@ def get_default_bbox_extra_artists(self):
23292329
if ax.get_visible():
23302330
bbox_artists.extend(ax.get_default_bbox_extra_artists())
23312331
# we don't want the figure's patch to influence the bbox calculation
2332-
bbox_artists.remove(self.patch)
2332+
if self.patch in bbox_artists:
2333+
bbox_artists.remove(self.patch)
23332334
return bbox_artists
23342335

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

0 commit comments

Comments
 (0)