matplotlib.colors.PowerNorm#

classmatplotlib.colors.PowerNorm(gamma,vmin=None,vmax=None,clip=False)[source]#

Bases:Normalize

Linearly map a given value to the 0-1 range and then applya power-law normalization over that range.

Parameters:
gammafloat

Power law exponent.

vmin, vmaxfloat or None

Ifvmin and/orvmax is not given, they are initialized from theminimum and maximum value, respectively, of the first inputprocessed; i.e.,__call__(A) callsautoscale_None(A).

clipbool, default: False

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

If clipping is off, values abovevmax are transformed by the powerfunction, resulting in values above 1, and values belowvmin are linearlytransformed resulting in values below 0. This behavior is usually desirable, ascolormaps can mark theseunder andover values with specific colors.

If clipping is on, values belowvmin are mapped to 0 and values abovevmax are mapped to 1. Such values become indistinguishable fromregular boundary values, which may cause misinterpretation of the data.

Notes

The normalization formula is

\[\left ( \frac{x - v_{min}}{v_{max} - v_{min}} \right )^{\gamma}\]

For input values belowvmin, gamma is set to one.

Parameters:
vmin, vmaxfloat or None

Values within the range[vmin,vmax] from the input data will belinearly mapped to[0,1]. If eithervmin orvmax is notprovided, they default to the minimum and maximum values of the input,respectively.

clipbool, default: False

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

If clipping is off, values outside the range[vmin,vmax] arealso transformed, resulting in values outside[0,1]. Thisbehavior is usually desirable, as colormaps can mark theseunderandover values with specific colors.

If clipping is on, values belowvmin are mapped to 0 and valuesabovevmax are mapped to 1. Such values become indistinguishablefrom regular boundary values, which may cause misinterpretation ofthe data.

Notes

Ifvmin==vmax, input data will be mapped to 0.

__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 parameterclip inNormalize.

IfNone, defaults toself.clip (which defaults toFalse).

Notes

If not already initialized,self.vmin andself.vmax areinitialized usingself.autoscale_None(value).

inverse(value)[source]#

Maps the normalized value (i.e., index in the colormap) back to imagedata value.

Parameters:
value

Normalized value.

Examples usingmatplotlib.colors.PowerNorm#

Colormap normalizations

Colormap normalizations

Exploring normalizations

Exploring normalizations

Shaded & power normalized rendering

Shaded & power normalized rendering

Colormap normalization

Colormap normalization