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

Skip to content

Commit fe93c18

Browse files
authored
Merge pull request #15930 from meeseeksmachine/auto-backport-of-pr-15925-on-v3.2.x
Backport PR #15925 on branch v3.2.x (Optimize setting units to None when they're already None.)
2 parents ad65e98 + 1adcf2a commit fe93c18

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

lib/matplotlib/axis.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,18 +1584,12 @@ def set_units(self, u):
15841584
----------
15851585
u : units tag
15861586
"""
1587-
pchanged = False
1588-
if u is None:
1589-
self.units = None
1590-
pchanged = True
1591-
else:
1592-
if u != self.units:
1593-
self.units = u
1594-
pchanged = True
1595-
if pchanged:
1596-
self._update_axisinfo()
1597-
self.callbacks.process('units')
1598-
self.callbacks.process('units finalize')
1587+
if u == self.units:
1588+
return
1589+
self.units = u
1590+
self._update_axisinfo()
1591+
self.callbacks.process('units')
1592+
self.callbacks.process('units finalize')
15991593
self.stale = True
16001594

16011595
def get_units(self):

0 commit comments

Comments
 (0)