matplotlib.colors.MultiNorm#

class matplotlib.colors.MultiNorm(norms, vmin=None, vmax=None, clip=None)[source]#

Bases: Norm

A class which contains multiple scalar norms.

Parameters:
normslist of (str or Normalize)

The constituent norms. The list must have a minimum length of 1.

vmin, vmaxNone or list of (float or None)

Limits of the constituent norms. If a list, one value is assigned to each of the constituent norms. If None, the limits of the constituent norms are not changed.

clipNone or list of bools, default: None

Determines the behavior for mapping values outside the range [vmin, vmax] for the constituent norms. If a list, each value is assigned to each of the constituent norms. If None, the behaviour of the constituent norms is not changed.

__call__(values, clip=None)[source]#

Normalize the data and return the normalized data.

Each component of the input is normalized via the constituent norm.

Parameters:
valuesarray-like

The input data, as an iterable or a structured numpy array.

  • If iterable, must be of length n_components. Each element can be a scalar or array-like and is normalized through the corresponding norm.

  • If structured array, must have n_components fields. Each field is normalized through the corresponding norm.

cliplist of bools or None, optional

Determines the behavior for mapping values outside the range [vmin, vmax]. See the description of the parameter clip in Normalize. If None, defaults to self.clip (which defaults to False).

Returns:
tuple

Normalized input values

Notes

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

autoscale(A)[source]#

For each constituent norm, set vmin, vmax to min, max of the corresponding component in A.

Parameters:
Aarray-like

The input data, as an iterable or a structured numpy array.

  • If iterable, must be of length n_components. Each element is used for the limits of one constituent norm.

  • If structured array, must have n_components fields. Each field is used for the limits of one constituent norm.

autoscale_None(A)[source]#

If vmin or vmax are not set on any constituent norm, use the min/max of the corresponding component in A to set them.

Parameters:
Aarray-like

The input data, as an iterable or a structured numpy array.

  • If iterable, must be of length n_components. Each element is used for the limits of one constituent norm.

  • If structured array, must have n_components fields. Each field is used for the limits of one constituent norm.

property clip#

The clip behaviour of each constituent norm.

inverse(values)[source]#

Map the normalized values (i.e., index in the colormap) back to data values.

Parameters:
valuesarray-like

The input data, as an iterable or a structured numpy array.

  • If iterable, must be of length n_components. Each element can be a scalar or array-like and is mapped through the corresponding norm.

  • If structured array, must have n_components fields. Each field is mapped through the the corresponding norm.

property n_components#

Number of norms held by this MultiNorm.

property norms#

The individual norms held by this MultiNorm.

scaled()[source]#

Return whether both vmin and vmax are set on all constituent norms.

property vmax#

The upper limit of each constituent norm.

property vmin#

The lower limit of each constituent norm.