matplotlib 3.5.1

ParametersReturns
from_levels_and_colors(levels, colors, extend='neither')

Parameters

levels : sequence of numbers

The quantization levels used to construct the BoundaryNorm . Value v is quantized to level i if lev[i] <= v < lev[i+1] .

colors : sequence of colors

The fill color to use for each level. If extend is "neither" there must be n_level - 1 colors. For an extend of "min" or "max" add one extra color, and for an extend 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 ~.Axes.contourf for details.

Returns

cmap : `~matplotlib.colors.Normalize`
norm : `~matplotlib.colors.Colormap`

A helper routine to generate a cmap and a norm instance which behave similar to contourf's levels and colors arguments.

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /matplotlib/colors.py#2405
type: <class 'function'>
Commit: