Colorcet

3.1.0 · active · verified Sat Apr 11

Colorcet is a collection of perceptually uniform and distinct colormaps for use with Python plotting programs like Matplotlib, Bokeh, HoloViews, and Datashader. It provides 256-color continuous colormaps based on Peter Kovesi's work and perceptually distinct categorical colormaps. The library is actively maintained, with the current version being 3.1.0, and receives updates for new colormaps and compatibility with the Python ecosystem.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to import `colorcet` and apply one of its continuous colormaps to a Matplotlib plot. It also shows how to access a categorical palette as a list of hex strings.

import numpy as np
import matplotlib.pyplot as plt
import colorcet as cc

# Create some dummy data
xs, _ = np.meshgrid(np.linspace(0, 1, 80), np.linspace(0, 1, 10))

# Use a continuous colormap from colorcet with Matplotlib
plt.figure(figsize=(8, 1))
plt.imshow(xs, cmap=cc.cm.fire, aspect='auto')
plt.title('Using colorcet.cm.fire')
plt.axis('off')
plt.show()

# Example of a categorical palette (prints hex codes)
print(f"First 5 colors of glasbey palette: {cc.glasbey[:5]}")

view raw JSON →