SegmentedNorm¶
- class SegmentedNorm(levels, vmin=None, vmax=None, clip=False)[source]¶
Bases:
matplotlib.colors.Normalize
Normalizer that scales data linearly with respect to the interpolated index in an arbitrary monotonically increasing level sequence.
- Parameters
Note
This normalizer adapts the algorithm used by
LinearSegmentedColormap
to select colors in-between indices in segment data tables.Example
In the below example, unevenly spaced levels are passed to
contourf
, resulting in the automatic application ofSegmentedNorm
.>>> import proplot as pplt >>> import numpy as np >>> levels = [1, 2, 5, 10, 20, 50, 100, 200, 500, 1000] >>> data = 10 ** (3 * np.random.rand(10, 10)) >>> fig, ax = pplt.subplots() >>> ax.contourf(data, levels=levels)
Methods Summary
__call__
(value[, clip])Normalize the data values to 0-1.
inverse
(value)Inverse operation of
__call__
.