Skip to content

Commit 150faa1

Browse files
authored
Check that the figure patch is in bbox_artists before trying to remove. (#14374)
Check that the figure patch is in bbox_artists before trying to remove.
2 parents 765d452 + 2079bde commit 150faa1

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
@@ -2340,7 +2340,8 @@ def get_default_bbox_extra_artists(self):
23402340
if ax.get_visible():
23412341
bbox_artists.extend(ax.get_default_bbox_extra_artists())
23422342
# we don't want the figure's patch to influence the bbox calculation
2343-
bbox_artists.remove(self.patch)
2343+
if self.patch in bbox_artists:
2344+
bbox_artists.remove(self.patch)
23442345
return bbox_artists
23452346

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

0 commit comments

Comments
 (0)