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

Skip to content

Commit bfc96a6

Browse files
committed
Remove unused clip parameter
Need to allow it in __call__ since colorbar can pass a value for clip.
1 parent 2919b53 commit bfc96a6

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

lib/matplotlib/colors.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ class PiecewiseLinearNorm(Normalize):
970970
971971
Normalizes data into the ``[0.0, 1.0]`` interval.
972972
"""
973-
def __init__(self, vmin=None, vcenter=None, vmax=None, clip=False):
973+
def __init__(self, vmin=None, vcenter=None, vmax=None):
974974
"""Normalize data with an offset midpoint
975975
976976
Useful when mapping data unequally centered around a conceptual
@@ -990,11 +990,6 @@ def __init__(self, vmin=None, vcenter=None, vmax=None, clip=False):
990990
The data value that defines ``1.0`` in the normalized data.
991991
Defaults to the the max value of the dataset.
992992
993-
clip : bool, optional (default is False)
994-
If *clip* is True, values beyond *vmin* and *vmax* will be set
995-
to ``0.0`` or ``1.0``, respectively. Otherwise, values outside
996-
the ``[0.0, 1.0]`` will be returned.
997-
998993
Examples
999994
--------
1000995
>>> import matplotlib.colors as mcolors
@@ -1008,11 +1003,9 @@ def __init__(self, vmin=None, vcenter=None, vmax=None, clip=False):
10081003
self.vmin = vmin
10091004
self.vcenter = vcenter
10101005
self.vmax = vmax
1011-
self.clip = clip
10121006

10131007
def __call__(self, value, clip=None):
1014-
if clip is None:
1015-
clip = self.clip
1008+
"""Map value to the interval [0, 1]. The clip argument is unused."""
10161009

10171010
result, is_scalar = self.process_value(value)
10181011

@@ -1028,10 +1021,6 @@ def __call__(self, value, clip=None):
10281021
vmin = float(vmin)
10291022
vcenter = float(vcenter)
10301023
vmax = float(vmax)
1031-
if clip:
1032-
mask = ma.getmask(result)
1033-
result = ma.array(np.clip(result.filled(vmax), vmin, vmax),
1034-
mask=mask)
10351024

10361025
x, y = [vmin, vcenter, vmax], [0, 0.5, 1]
10371026
# returns a scalar if shape == (1,)

0 commit comments

Comments
 (0)