matplotlib 3.5.1

NotesParametersReturns
__init__(self, boundaries, ncolors, clip=False, *, extend='neither')

Notes

boundaries defines the edges of bins, and data falling within a bin is mapped to the color with the same index.

If the number of bins, including any extensions, is less than ncolors, the color index is chosen by linear interpolation, mapping the [0, nbins - 1] range onto the [0, ncolors - 1] range.

Parameters

boundaries : array-like

Monotonically increasing sequence of at least 2 boundaries.

ncolors : int

Number of colors in the colormap to be used.

clip : bool, optional

If clip is True , out of range values are mapped to 0 if they are below boundaries[0] or mapped to ncolors - 1 if they are above boundaries[-1] .

If clip is False , out of range values are mapped to -1 if they are below boundaries[0] or mapped to ncolors if they are above boundaries[-1] . These are then converted to valid indices by Colormap.__call__ .

extend : {'neither', 'both', 'min', 'max'}, default: 'neither'

Extend the number of bins to include one or both of the regions beyond the boundaries. For example, if extend is 'min', then the color to which the region between the first pair of boundaries is mapped will be distinct from the first color in the colormap, and by default a ~matplotlib.colorbar.Colorbar will be drawn with the triangle extension on the left or lower end.

Returns

int16 scalar or array

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#1721
type: <class 'function'>
Commit: