matplotlib.colors.Norm#

class matplotlib.colors.Norm[source]#

Bases: ABC

Abstract base class for normalizations.

Subclasses include Normalize which maps from a scalar to a scalar. However, this class makes no such requirement, and subclasses may support the normalization of multiple variates simultaneously, with separate normalization for each variate.

abstractmethod __call__(value, clip=None)[source]#

Normalize the data and return the normalized data.

Parameters:
value

Data to normalize.

clipbool, optional

See the description of the parameter clip in Normalize.

If None, defaults to self.clip (which defaults to False).

Notes

If not already initialized, self.vmin and self.vmax are initialized using self.autoscale_None(value).

abstractmethod autoscale(A)[source]#

Set vmin, vmax to min, max of A.

abstractmethod autoscale_None(A)[source]#

If vmin or vmax are not set, use the min/max of A to set them.

abstract property clip#

Determines the behavior for mapping values outside the range [vmin, vmax].

See the clip parameter in Normalize.

abstract property n_components#

The number of normalized components.

This is the number of elements of the parameter to __call__ and of vmin, vmax.

abstractmethod scaled()[source]#

Return whether vmin and vmax are both set.

abstract property vmax#

Upper limit of the input data interval; maps to 1.

abstract property vmin#

Lower limit of the input data interval; maps to 0.

Examples using matplotlib.colors.Norm#

Mapping marker properties to multivariate data

Mapping marker properties to multivariate data

Colormap normalizations

Colormap normalizations

Colormap normalizations SymLogNorm

Colormap normalizations SymLogNorm

Contour image

Contour image

Annotated heatmap

Annotated heatmap

Image with masked values

Image with masked values

Blend transparency with color in 2D images

Blend transparency with color in 2D images

Multiple images with one colorbar

Multiple images with one colorbar

pcolor images

pcolor images

pcolormesh

pcolormesh

Histograms

Histograms

Histogram as colorbar

Histogram as colorbar

Shaded & power normalized rendering

Shaded & power normalized rendering

2D images in 3D

2D images in 3D

Exploring normalizations

Exploring normalizations

Hillshading

Hillshading

Left ventricle bullseye

Left ventricle bullseye

Quick start guide

Quick start guide

Constrained layout guide

Constrained layout guide

Customized Colorbars Tutorial

Customized Colorbars Tutorial

Colormap normalization

Colormap normalization