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

Commitb26748d

Browse files
committed
TST: Adding tests for clip and vcenter to norm updater
1 parent3c6e144 commitb26748d

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

‎lib/matplotlib/colors.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1439,7 +1439,9 @@ def vcenter(self):
14391439

14401440
@vcenter.setter
14411441
defvcenter(self,vcenter):
1442-
self._vcenter=vcenter
1442+
ifvcenter!=self._vcenter:
1443+
self._vcenter=vcenter
1444+
self._changed()
14431445
ifself.vmaxisnotNone:
14441446
# recompute halfrange assuming vmin and vmax represent
14451447
# min and max of data

‎lib/matplotlib/tests/test_colors.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,3 +1417,17 @@ def test_scalarmappable_norm_update():
14171417
sm.stale=False
14181418
norm.vmax=5
14191419
assertsm.stale
1420+
sm.stale=False
1421+
norm.clip=True
1422+
assertsm.stale
1423+
# change to the CenteredNorm and TwoSlopeNorm to test those
1424+
norm=mcolors.CenteredNorm()
1425+
sm=matplotlib.cm.ScalarMappable(norm=norm,cmap='plasma')
1426+
sm.stale=False
1427+
norm.vcenter=1
1428+
assertsm.stale
1429+
norm=mcolors.TwoSlopeNorm(vcenter=0,vmin=-1,vmax=1)
1430+
sm=matplotlib.cm.ScalarMappable(norm=norm,cmap='plasma')
1431+
sm.stale=False
1432+
norm.vcenter=1
1433+
assertsm.stale

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp