librosa.display.cmap

librosa.display.cmap(data, *, robust=True, cmap_seq='magma', cmap_bool='gray_r', cmap_div='coolwarm')[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

The sequential colormap name

cmap_boolstr

The boolean colormap name

cmap_divstr

The diverging colormap name

Returns:
cmapmatplotlib.colors.Colormap

The colormap to use for data