A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/JosephBARBIERDARNAL/pypalettes below:

JosephBARBIERDARNAL/pypalettes: A large (+2500) collection of color maps for Python

A large (+2500) collection of color maps for Python.

This package is based on the R package paletteer, and all associated sub-packages (with original palettes) mentioned in the LICENSE file.

With pip:

With conda:

conda install conda-forge::pypalettes

Once pypalettes is imported, all the palettes are now accessible as any other colormap in matplotlib or seaborn via the palette or cmap arguments.

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()

import matplotlib.pyplot as plt
import seaborn as sns
from pypalettes import load_cmap

cmap = load_cmap("Fun")
palette = cmap.colors # return colors as a list of hexadecimal values

df = sns.load_dataset("penguins")

g = sns.lmplot(
    data=df,
    x="bill_length_mm",
    y="bill_depth_mm",
    hue="species",
    palette=palette,
)

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()

Going further

To find out more about using PyPalettes, use this PyPalettes guide.

Chart made with pypalettes

Click on the image to get the associated code!


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


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4