DiscreteNorm

class DiscreteNorm(levels, norm=None, step=1.0, extend=None, clip=False, descending=False)[source]

Bases: matplotlib.colors.BoundaryNorm

Meta-normalizer that discretizes the possible color values returned by arbitrary continuous normalizers given a list of level boundaries. This is applied to all colormap plots in ProPlot.

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

  • norm (Normalize, optional) – The normalizer used to transform levels and all data passed to __call__ before discretization. The vmin and vmax of the normalizer are set to the minimum and maximum values in levels.

  • step (float, optional) – The intensity of the transition to out-of-bounds colors as a fraction of the adjacent step between in-bounds colors. Default is 1.

  • extend ({‘neither’, ‘both’, ‘min’, ‘max’}, optional) – Which out-of-bounds regions should be assigned unique colormap colors. The normalizer needs this information so it can ensure the colorbar always spans the full range of colormap colors.

  • clip (bool, optional) – Whether to clip values falling outside of the level bins. This only has an effect on lower colors when extend is 'min' or 'both', and on upper colors when extend is 'max' or 'both'.

  • descending (bool, optional) – Whether the levels are meant to be descending. This will cause the colorbar axis to be reversed when it is drawn with a ScalarMappable that uses this normalizer.

Note

If you are using a diverging colormap with extend='max' or extend='min', the center will get messed up. But that is very strange usage anyway… so please just don’t do that :)

Methods Summary

__call__(value[, clip])

Normalize data values to 0-1.

inverse(value)

Raise an error.