Caution

You're reading the documentation for a development version. For the latest released version, please have a look at 0.11.0.

librosa.display.infer_cmap

librosa.display.infer_cmap(data, *, robust=True, cmap_seq='magma', cmap_bool='gray_r', cmap_div='coolwarm', div_thresh=0.0)[source]

Get a default colormap from the given data.

If the data is boolean, use a black and white colormap.

If the data has both positive and negative values, use a diverging colormap.

Otherwise, use a sequential colormap.

Parameters:
datanp.ndarray

Input data

robustbool

If True, discard the top and bottom 2% of data when calculating range.

cmap_seqstr or matplotlib.colors.Colormap

The sequential colormap

cmap_boolstr or matplotlib.colors.Colormap

The boolean colormap

cmap_divstr or matplotlib.colors.Colormap

The diverging colormap

div_threshfloat

The threshold for determining whether to use a diverging colormap. If the data has values both above and below this threshold, then a diverging colormap is used.

Returns:
cmapmatplotlib.colors.Colormap

The colormap to use for data