Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc9ce08d

Browse files
authored
Merge pull request#25082 from meeseeksmachine/auto-backport-of-pr-25079-on-v3.7.x
Backport PR#25079 on branch v3.7.x (FIX: Only send one update signal when autoscaling norms)
2 parentsbcb750c +fcdcbee commitc9ce08d

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

‎lib/matplotlib/colors.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,8 +1372,12 @@ def inverse(self, value):
13721372

13731373
defautoscale(self,A):
13741374
"""Set *vmin*, *vmax* to min, max of *A*."""
1375-
self.vmin=self.vmax=None
1376-
self.autoscale_None(A)
1375+
withself.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()
13771381

13781382
defautoscale_None(self,A):
13791383
"""If vmin or vmax are not set, use the min/max of *A* to set them."""

‎lib/matplotlib/tests/test_colors.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,6 +1493,11 @@ def test_norm_callback():
14931493
norm.vmax=5
14941494
assertincrement.call_count==2
14951495

1496+
# We only want autoscale() calls to send out one update signal
1497+
increment.call_count=0
1498+
norm.autoscale([0,1,2])
1499+
assertincrement.call_count==1
1500+
14961501

14971502
deftest_scalarmappable_norm_update():
14981503
norm=mcolors.Normalize()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp