matplotlib.colors.TwoSlopeNorm#
- classmatplotlib.colors.TwoSlopeNorm(vcenter,vmin=None,vmax=None)[source]#
Bases:
NormalizeNormalize data with a set center.
Useful when mapping data with an unequal rates of change around aconceptual center, e.g., data that range from -2 to 4, with 0 asthe midpoint.
- Parameters:
- vcenterfloat
The data value that defines
0.5in the normalization.- vminfloat, optional
The data value that defines
0.0in the normalization.Defaults to the min value of the dataset.- vmaxfloat, optional
The data value that defines
1.0in the normalization.Defaults to the max value of the dataset.
Examples
This maps data value -4000 to 0., 0 to 0.5, and +10000 to 1.0; databetween is linearly interpolated:
>>>importmatplotlib.colorsasmcolors>>>offset=mcolors.TwoSlopeNorm(vmin=-4000.,...vcenter=0.,vmax=10000)>>>data=[-4000.,-2000.,0.,2500.,5000.,7500.,10000.]>>>offset(data)array([0., 0.25, 0.5, 0.625, 0.75, 0.875, 1.0])
- autoscale_None(A)[source]#
Get vmin and vmax.
If vcenter isn't in the range [vmin, vmax], either vmin or vmaxis expanded so that vcenter lies in the middle of the modified range[vmin, vmax].
- inverse(value)[source]#
Maps the normalized value (i.e., index in the colormap) back to imagedata value.
- Parameters:
- value
Normalized value.
- propertyvcenter#