File tree 2 files changed +11
-2
lines changed
2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -1372,8 +1372,12 @@ def inverse(self, value):
1372
1372
1373
1373
def autoscale (self , A ):
1374
1374
"""Set *vmin*, *vmax* to min, max of *A*."""
1375
- self .vmin = self .vmax = None
1376
- self .autoscale_None (A )
1375
+ with self .callbacks .blocked ():
1376
+ # Pause callbacks while we are updating so we only get
1377
+ # a single update signal at the end
1378
+ self .vmin = self .vmax = None
1379
+ self .autoscale_None (A )
1380
+ self ._changed ()
1377
1381
1378
1382
def autoscale_None (self , A ):
1379
1383
"""If vmin or vmax are not set, use the min/max of *A* to set them."""
Original file line number Diff line number Diff line change @@ -1493,6 +1493,11 @@ def test_norm_callback():
1493
1493
norm .vmax = 5
1494
1494
assert increment .call_count == 2
1495
1495
1496
+ # We only want autoscale() calls to send out one update signal
1497
+ increment .call_count = 0
1498
+ norm .autoscale ([0 , 1 , 2 ])
1499
+ assert increment .call_count == 1
1500
+
1496
1501
1497
1502
def test_scalarmappable_norm_update ():
1498
1503
norm = mcolors .Normalize ()
You can’t perform that action at this time.
0 commit comments