make_random_cmap

photutils.utils.make_random_cmap(ncolors=256, seed=None)[source]

Make a matplotlib colormap consisting of (random) muted colors.

A random colormap is very useful for plotting segmentation images.

Parameters:
ncolorsint, optional

The number of colors in the colormap. The default is 256.

seedint, optional

A seed to initialize the numpy.random.BitGenerator. If None, then fresh, unpredictable entropy will be pulled from the OS. Separate function calls with the same seed will generate the same colormap.

Returns:
cmapmatplotlib.colors.ListedColormap

The matplotlib colormap with random colors in RGBA format.