Skip to content

Commit 7d97c40

Browse files
committed
avoid warning in savefig
1 parent fbc4f4c commit 7d97c40

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2061,6 +2061,8 @@ def print_figure(self, filename, dpi=None, facecolor=None, edgecolor=None,
20612061
canvas.fixed_dpi)
20622062

20632063
_bbox_inches_restore = (bbox_inches, restore_bbox)
2064+
orig_tight_layout = self.figure.get_tight_layout()
2065+
self.figure.set_tight_layout(False)
20642066
else:
20652067
_bbox_inches_restore = None
20662068

@@ -2076,7 +2078,8 @@ def print_figure(self, filename, dpi=None, facecolor=None, edgecolor=None,
20762078
finally:
20772079
if bbox_inches and restore_bbox:
20782080
restore_bbox()
2079-
2081+
if bbox_inches:
2082+
self.figure.set_tight_layout(orig_tight_layout)
20802083
self.figure.set_facecolor(origfacecolor)
20812084
self.figure.set_edgecolor(origedgecolor)
20822085
self.figure.set_canvas(self)

0 commit comments

Comments
 (0)