class LinearSegmentedNorm(levels, vmin=None, vmax=None, **kwargs)[source]

Bases: matplotlib.colors.Normalize

This is the default normalizer paired with BinNorm whenever levels are non-linearly spaced. The normalized value is linear with respect to its average index in the levels vector, allowing uniform color transitions across arbitrarily spaced monotonically increasing values.

It accomplishes this following the example of the LinearSegmentedColormap source code, by performing efficient, vectorized linear interpolation between the provided boundary levels.

Can be used by passing norm='segmented' or norm='segments' to any command accepting cmap. The default midpoint is zero.

  • levels (list of float) – The discrete data levels.

  • vmin, vmax (None) – Ignored, because vmin and vmax are set to the minimum and maximum of levels.

  • **kwargs – Passed to Normalize.

Methods Summary

__call__(xq[, clip])

Normalizes data values to the range 0-1.


Inverse operation of __call__.