maad.util.rand_cmap

maad.util.rand_cmap(nlabels, type='bright', first_color_black=True, last_color_black=False, seed=321, verbose=False)[source]

Creates a random colormap to be used together with matplotlib. Useful for segmentation tasks

Parameters:
nlabelsint

Number of labels (size of colormap)

typestring

‘bright’ for strong colors, ‘soft’ for pastel colors. Default is ‘bright’

first_color_blackbool, optional

Option to use first color as black. Default is True

last_color_blackbool, optional

Option to use last color as black. Default is False

seedint, optional

Fix the seed of the random engine. Default is 321

verbosebool, optional

Prints the number of labels and shows the colormap. Default is False

Returns:
random_colormapColormap

Colormap type used by matplotlib

References

adapted from https://github.com/delestro/rand_cmap author : delestro