Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 01e261e

Browse files
committed
MNT: if the figure size is not changed, bail early
This avoids marking the figure as stale un-necessarily. Also remove a local variable which is immediately replaced below.
1 parent 19630b2 commit 01e261e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/matplotlib/figure.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2954,6 +2954,8 @@ def set_size_inches(self, w, h=None, forward=True):
29542954
if not np.isfinite(size).all() or (size < 0).any():
29552955
raise ValueError(f'figure size must be positive finite not {size}')
29562956
self.bbox_inches.p1 = size
2957+
if tuple(size) == (w, h) and not forward:
2958+
return
29572959
if forward:
29582960
manager = self.canvas.manager
29592961
if manager is not None:

0 commit comments

Comments
 (0)