Fork me on GitHub


Table Of Contents

This Page


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:


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.


Set vmin, vmax to min, max of A.


autoscale only None-valued vmin or vmax.

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.


return true if vmin and vmax set