class SegmentedNorm(levels, vmin=None, vmax=None, clip=False)[source]

Bases: matplotlib.colors.Normalize

Normalizer that scales data linearly with respect to the interpolated list index in an arbitrary monotonically increasing level list.

  • levels (list of float) – The level boundaries.

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

  • clip (bool, optional) – Whether to clip values falling outside of the minimum and maximum levels.


This normalizer adapts the algorithm used by LinearSegmentedColormap to select colors in-between indices in segment data tables.


In the below example, unevenly spaced levels are passed to contourf, resulting in the automatic application of SegmentedNorm.

>>> 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 operation of __call__.