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

Skip to content

Commit ce016e2

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 3d1dc58 commit ce016e2

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

lib/matplotlib/cm.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,8 @@ def set_clim(self, vmin=None, vmax=None):
418418
419419
.. ACCEPTS: (vmin: float, vmax: float)
420420
"""
421+
# If the norm's limits are updated self.changed() will be called
422+
# through the callbacks attached to the norm
421423
if vmax is None:
422424
try:
423425
vmin, vmax = vmin
@@ -427,7 +429,6 @@ def set_clim(self, vmin=None, vmax=None):
427429
self.norm.vmin = colors._sanitize_extrema(vmin)
428430
if vmax is not None:
429431
self.norm.vmax = colors._sanitize_extrema(vmax)
430-
self.changed()
431432

432433
def get_alpha(self):
433434
"""
@@ -482,8 +483,9 @@ def autoscale(self):
482483
"""
483484
if self._A is None:
484485
raise TypeError('You must first set_array for mappable')
486+
# If the norm's limits are updated self.changed() will be called
487+
# through the callbacks attached to the norm
485488
self.norm.autoscale(self._A)
486-
self.changed()
487489

488490
def autoscale_None(self):
489491
"""
@@ -492,7 +494,7 @@ def autoscale_None(self):
492494
"""
493495
if self._A is None:
494496
raise TypeError('You must first set_array for mappable')
495-
# If the norm updates the limits *self.changed()* will be called
497+
# If the norm's limits are updated self.changed() will be called
496498
# through the callbacks attached to the norm
497499
self.norm.autoscale_None(self._A)
498500

0 commit comments

Comments
 (0)