mpl.colors.BoundaryNorm

class mpl.colors.BoundaryNorm(boundaries, ncolors, clip=False)[source]

Generate a colormap index based on discrete intervals.

Unlike Normalize or LogNorm, BoundaryNorm maps values to integers instead of to the interval 0-1.

Mapping to the 0-1 interval could have been done via piece-wise linear interpolation, but using integers seems simpler, and reduces the number of conversions back and forth between integer and floating point.

__init__(boundaries, ncolors, clip=False)[source]
boundaries
a monotonically increasing sequence
ncolors
number of colors in the colormap to be used

If:

b[i] <= v < b[i+1]

then v is mapped to color j; as i varies from 0 to len(boundaries)-2, j goes from 0 to ncolors-1.

Out-of-range values are mapped to -1 if low and ncolors if high; these are converted to valid indices by Colormap.__call__() . If clip == True, out-of-range values are mapped to 0 if low and ncolors-1 if high.

Methods

__init__(boundaries, ncolors[, clip]) boundaries
autoscale(A) Set vmin, vmax to min, max of A.
autoscale_None(A) autoscale only None-valued vmin or vmax
inverse(value)
process_value(value) Homogenize the input value for easy and efficient normalization.
scaled() return true if vmin and vmax set