matplotlib.colors.from_levels_and_colors
-
matplotlib.colors.from_levels_and_colors(levels, colors, extend='neither')
-
A helper routine to generate a cmap and a norm instance which behave similar to contourf’s levels and colors arguments.
Parameters: levels : sequence of numbers
The quantization levels used to construct the
BoundaryNorm
. Valuesv
are quantizized to leveli
iflev[i] <= v < lev[i+1]
.colors : sequence of colors
The fill color to use for each level. If
extend
is “neither” there must ben_level - 1
colors. For anextend
of “min” or “max” add one extra color, and for anextend
of “both” add two colors.extend : {‘neither’, ‘min’, ‘max’, ‘both’}, optional
The behaviour when a value falls out of range of the given levels. See
contourf()
for details.Returns: (cmap, norm) : tuple containing a
Colormap
and aNormalize
instance
© 2012–2017 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
http://matplotlib.org/2.1.0/api/_as_gen/matplotlib.colors.from_levels_and_colors.html