On this page
matplotlib.colors.Normalize
class matplotlib.colors.Normalize(vmin=None, vmax=None, clip=False)
-
A class which, when called, can normalize data into the
[0.0, 1.0]
interval.If vmin or vmax is not given, they are initialized from the minimum and maximum value respectively of the first input processed. That is, __call__(A) calls autoscale_None(A). If clip is True and the given value falls outside the range, the returned value will be 0 or 1, whichever is closer. Returns 0 if:
vmin==vmax
Works with scalars or arrays, including masked arrays. If clip is True, masked values are set to 1; otherwise they remain masked. Clipping silently defeats the purpose of setting the over, under, and masked colors in the colormap, so it is likely to lead to surprises; therefore the default is clip = False.
autoscale(A)
-
Set vmin, vmax to min, max of A.
autoscale_None(A)
-
autoscale only None-valued vmin or vmax.
inverse(value)
static process_value(value)
-
Homogenize the input value for easy and efficient normalization.
value can be a scalar or sequence.
Returns result, is_scalar, where result is a masked array matching value. Float dtypes are preserved; integer types with two bytes or smaller are converted to np.float32, and larger types are converted to np.float64. Preserving float32 when possible, and using in-place operations, can greatly improve speed for large arrays.
Experimental; we may want to add an option to force the use of float32.
scaled()
-
return true if vmin and vmax set
Examples using matplotlib.colors.Normalize
© 2012–2017 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
http://matplotlib.org/2.1.0/api/_as_gen/matplotlib.colors.Normalize.html