Skip to content



pypalettes

pypalettes logo A dependency-free large (+2500) collection of colormaps and palettes for Python.

total number of downloads of pypalettes

Get started

pypalettes primarly offers 2 functions:

  • load_palette("palette_name"): loads a list of colors (dependency-free)
  • load_cmap("palette_name"): loads a colormap object (for matplotlib/seaborn/etc)
# mkdocs: render
import matplotlib.pyplot as plt
import numpy as np
from pypalettes import load_cmap

cmap = load_cmap("Sunset2", cmap_type="continuous")

data = np.random.randn(20, 20)

plt.imshow(data, cmap=cmap)
plt.colorbar()
# mkdocs: render
import matplotlib.pyplot as plt
import seaborn as sns
from pypalettes import load_palette

palette = load_palette("Fun")

df = sns.load_dataset("penguins")

g = sns.lmplot(
    data=df,
    x="bill_length_mm",
    y="bill_depth_mm",
    hue="species",
    palette=palette,
)
# mkdocs: render
import matplotlib.pyplot as plt
from pypalettes import create_cmap
import numpy as np

cmap = create_cmap(
    colors=["#D57A6DFF", "#E8B762FF", "#9CCDDFFF", "#525052FF"],
    cmap_type="continuous",
)

x = np.linspace(0, 20, 1000)
y = np.sin(x)

plt.scatter(x, y, c=y, cmap=cmap)
plt.colorbar()

Installation

pip install pypalettes
conda install conda-forge::pypalettes

Acknowledgements

PyPalettes is highly inspired (and relies on for the first one) from

A big thanks to Yan Holtz for creating the Color Palette Finder, a web app for browsing palettes