8000 PiecewiseLinearNorm by OceanWolf · Pull Request #5061 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

PiecewiseLinearNorm #5061

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove unused clip parameter
Need to allow it in __call__ since colorbar can pass a value for clip.
  • Loading branch information
jkseppan authored and OceanWolf committed Sep 13, 2015
commit 1d1ff98f7ac1ca4f0cb31fbbeadb41c9c2f70be3
15 changes: 2 additions & 13 deletions lib/matplotlib/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ class PiecewiseLinearNorm(Normalize):

Normalizes data into the ``[0.0, 1.0]`` interval.
"""
def __init__(self, vmin=None, vcenter=None, vmax=None, clip=False):
def __init__(self, vmin=None, vcenter=None, vmax=None):
"""Normalize data with an offset midpoint

Useful when mapping data unequally centered around a conceptual
Expand All @@ -990,11 +990,6 @@ def __init__(self, vmin=None, vcenter=None, vmax=None, clip=False):
The data value that defines ``1.0`` in the normalized data.
Defaults to the the max value of the dataset.

clip : bool, optional (default is False)
If *clip* is True, values beyond *vmin* and *vmax* will be set
to ``0.0`` or ``1.0``, respectively. Otherwise, values outside
the ``[0.0, 1.0]`` will be returned.

Examples
--------
>>> import matplotlib.colors as mcolors
Expand All @@ -1008,11 +1003,9 @@ def __init__(self, vmin=None, vcenter=None, vmax=None, clip=False):
self.vmin = vmin
self.vcenter = vcenter
self.vmax = vmax
self.clip = clip

def __call__(self, value, clip=None):
if clip is None:
clip = self.clip
"""Map value to the interval [0, 1]. The clip argument is unused."""

result, is_scalar = self.process_value(value)

Expand All @@ -1028,10 +1021,6 @@ def __call__(self, value, clip=None):
vmin = float(vmin)
vcenter = float(vcenter)
vmax = float(vmax)
if clip:
mask = ma.getmask(result)
result = ma.array(np.clip(result.filled(vmax), vmin, vmax),
mask=mask)

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