In Matplotlib (Python’s main plotting library), cmap='viridis' refers to one of many colormaps available for visualizing data.
There are several other built-in colormaps grouped by category. Here’s a full list by type:
viridis)These are designed to be perceptually uniform — meaning differences in color correspond to equal differences in data value:
'viridis' 🟢🟡🟣 (default modern choice)'plasma' 🔵🟣🟠'inferno' 🟣🔴🟡'magma' 🟣🟤🟡'cividis' 🔵🟢🟡 (colorblind-friendly)Used for data that progresses from low to high (e.g., temperature, intensity):
'Greys', 'Purples', 'Blues', 'Greens', 'Oranges', 'Reds''YlOrBr', 'YlOrRd', 'OrRd', 'PuRd', 'RdPu''BuPu', 'GnBu', 'PuBu', 'PuBuGn', 'BuGn''YlGnBu', 'YlGn'Used when data diverges around a central point (e.g., positive vs negative changes):
'PiYG', 'PRGn', 'BrBG', 'PuOr', 'RdGy', 'RdBu''RdYlBu', 'RdYlGn', 'Spectral', 'coolwarm', 'bwr', 'seismic'For data that wraps around (e.g., angles, time of day):
'twilight', 'twilight_shifted', 'hsv'For discrete categories rather than numeric data:
'Pastel1', 'Pastel2', 'Paired', 'Accent', 'Dark2''Set1', 'Set2', 'Set3', 'tab10', 'tab20', 'tab20b', 'tab20c''flag', 'prism', 'ocean', 'gist_earth', 'terrain', 'gist_stern''gnuplot', 'gnuplot2', 'CMRmap', 'cubehelix', 'brg', 'rainbow''jet' (old default, not recommended — not perceptually uniform)import matplotlib.pyplot as plt
plt.imshow(data, cmap='plasma')
plt.colorbar()
plt.show()