Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2df4a3b

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

File tree

Expand file treeCollapse file tree

1 file changed

+4
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-3
lines changed

‎lib/matplotlib/backend_bases.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py
+4-3Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.