Skip to content

Contour norm scaling #1057

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

Merged
merged 6 commits into from
Aug 11, 2012
Merged
Prev Previous commit
Next Next commit
colors: avoid problems with bad values under the mask when color mapping
This change should have no effect on any plot, but it avoids
warnings that can arise when an inf occurs under a mask.
  • Loading branch information
efiring committed Aug 6, 2012
commit 8c582e47f3d5e00f68017c54db3523419adbced8
7 changes: 3 additions & 4 deletions lib/matplotlib/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,11 +510,10 @@ def __call__(self, X, alpha=None, bytes=False):
xa = np.array([X])
else:
vtype = 'array'
xma = ma.array(X, copy=False)
mask_bad = xma.mask
xa = xma.data.copy() # Copy here to avoid side effects.
xma = ma.array(X, copy=True) # Copy here to avoid side effects.
mask_bad = xma.mask # Mask will be used below.
xa = xma.filled() # Fill to avoid infs, etc.
del xma
# masked values are substituted below; no need to fill them here

if xa.dtype.char in np.typecodes['Float']:
# Treat 1.0 as slightly less than 1.
Expand Down