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

Appearance settings

Commit 8e6a866

Browse filesBrowse files
Tillstendmcdougall
authored andcommitted
fixed lognorm clip behavior
added test
1 parent bbac43a commit 8e6a866
Copy full SHA for 8e6a866

File tree

Expand file treeCollapse file tree

2 files changed

+10
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+10
-1
lines changed

‎lib/matplotlib/colors.py

Copy file name to clipboardExpand all lines: lib/matplotlib/colors.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ def __call__(self, value, clip=None):
953953
else:
954954
if clip:
955955
mask = ma.getmask(result)
956-
val = ma.array(np.clip(result.filled(vmax), vmin, vmax),
956+
result = ma.array(np.clip(result.filled(vmax), vmin, vmax),
957957
mask=mask)
958958
# in-place equivalent of above can be much faster
959959
resdat = result.data

‎lib/matplotlib/tests/test_colors.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_colors.py
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,13 @@ def test_BoundaryNorm():
3636
ncolors = len(boundaries)
3737
bn = mcolors.BoundaryNorm(boundaries, ncolors)
3838
assert_array_equal(bn(vals), expected)
39+
40+
def test_LogNorm():
41+
"""
42+
LogNorm igornoed clip, now it has the same
43+
behavior as Normalize, e.g. values > vmax are bigger than 1
44+
without clip, with clip they are 1.
45+
"""
46+
ln = mcolors.LogNorm(clip=True, vmax=5)
47+
assert_array_equal(ln([1, 6]), [0, 1.0])
3948

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.