Skip to content

Commit 2df4a3b

Browse files
committed
make Figure.print_figure to work even when bbox_extra_artists is empty
1 parent 8a5afe3 commit 2df4a3b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2049,11 +2049,12 @@ def print_figure(self, filename, dpi=None, facecolor='w', edgecolor='w',
20492049

20502050
bb = [a.get_window_extent(renderer) for a in bbox_extra_artists]
20512051

2052-
if bb:
2053-
_bbox = Bbox.union([b for b in bb if b.width!=0 or b.height!=0])
2052+
bbox_filtered = [b for b in bb if b.width!=0 or b.height!=0]
2053+
if bbox_filtered:
2054+
_bbox = Bbox.union(bbox_filtered)
20542055

20552056
bbox_inches1 = TransformedBbox(_bbox,
2056-
Affine2D().scale(1./self.figure.dpi))
2057+
Affine2D().scale(1./self.figure.dpi))
20572058

20582059
bbox_inches = Bbox.union([bbox_inches, bbox_inches1])
20592060

0 commit comments

Comments
 (0)