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

Skip to content

Commit 5fb2109

Browse files
committed
MNT: Remove unnecessary scalar mappable updates
Remove the extra calls to self.changed() in scalar mappable that are already handled by the callbacks attached to the norm.
1 parent 1e05bd2 commit 5fb2109

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/matplotlib/cm.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,8 @@ def set_clim(self, vmin=None, vmax=None):
402402
403403
.. ACCEPTS: (vmin: float, vmax: float)
404404
"""
405+
# If the norm's limits are updated self.changed() will be called
406+
# through the callbacks attached to the norm
405407
if vmax is None:
406408
try:
407409
vmin, vmax = vmin
@@ -411,7 +413,6 @@ def set_clim(self, vmin=None, vmax=None):
411413
self.norm.vmin = colors._sanitize_extrema(vmin)
412414
if vmax is not None:
413415
self.norm.vmax = colors._sanitize_extrema(vmax)
414-
self.changed()
415416

416417
def get_alpha(self):
417418
"""
@@ -466,8 +467,9 @@ def autoscale(self):
466467
"""
467468
if self._A is None:
468469
raise TypeError('You must first set_array for mappable')
470+
# If the norm's limits are updated self.changed() will be called
471+
# through the callbacks attached to the norm
469472
self.norm.autoscale(self._A)
470-
self.changed()
471473

472474
def autoscale_None(self):
473475
"""
@@ -476,7 +478,7 @@ def autoscale_None(self):
476478
"""
477479
if self._A is None:
478480
raise TypeError('You must first set_array for mappable')
479-
# If the norm updates the limits *self.changed()* will be called
481+
# If the norm's limits are updated self.changed() will be called
480482
# through the callbacks attached to the norm
481483
self.norm.autoscale_None(self._A)
482484

0 commit comments

Comments
 (0)