Skip to main content

A large collection of color maps for Python

Project description

PyPalettes

logo1 logo1 logo1 logo1 logo1 logo1

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

All available palettes can be found on the dedicated website

You can find an introduction to PyPalettes in the Python Graph Gallery, with code samples and explanations about how to use this library in many different cases.



Installation

You can install pypalettes directly from PyPI with:

pip install --upgrade pypalettes

Alternatively you can install the development version with:

pip install git+https://github.com/JosephBARBIERDARNAL/pypalettes.git



Quick start

Once the cmap is loaded, you can use it as any other color map in matplotlib or seaborn.

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

data = np.random.rand(10, 12)

cmap = load_cmap('Anemone', cmap_type='continuous')

sns.heatmap(data, cmap=cmap)
plt.show()

heatmap example



Getting started


  • Load a color map:
from pypalettes import load_cmap
cmap = load_cmap('Chaetodon_sedentarius')
cmap

Darjeeling2


  • Transform a qualitative color map into a continuous one:
from pypalettes import load_cmap
cmap = load_cmap('Chaetodon_sedentarius', cmap_type='continuous')
cmap

Darjeeling2


  • Invert a color map:
from pypalettes import load_cmap
cmap = load_cmap('Chaetodon_sedentarius', reverse=True)
cmap

Darjeeling2


  • Get hex values of a color map:
from pypalettes import get_hex
get_hex('pupitar')

['#7098C0FF', '#88C0E8FF', '#285880FF', '#B8E0F8FF', '#F8F8F8FF', '#404060FF', '#A8A8A8FF', '#C8C8D0FF', '#B04000FF']


  • Get rgb values of a color map:
from pypalettes import get_rgb
get_rgb('AirNomads')

[(255, 153, 51), (194, 72, 65), (255, 255, 51), (139, 91, 69), (135, 175, 209), (238, 176, 90), (219, 197, 160)]


More examples can be found in this introduction to PyPalettes.



Chart made with pypalettes

Click on the image to get the associated code!

choropleth map of europe stacked area chart of natural disasters
gapminder bubble chart



Acknowledgements

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

A big thanks to Yan Holtz for:



How data has been collected

99% of the palettes come from the Paletteer R package.

Learn more in the dedicated directory.



Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypalettes-0.1.2.tar.gz (360.6 kB view details)

Uploaded Source

File details

Details for the file pypalettes-0.1.2.tar.gz.

File metadata

  • Download URL: pypalettes-0.1.2.tar.gz
  • Upload date:
  • Size: 360.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.13

File hashes

Hashes for pypalettes-0.1.2.tar.gz
Algorithm Hash digest
SHA256 fed0d0c165182096f22e24459facc5ce8b36826f93abfe0b8948d3c8e6ce71e5
MD5 32747f8b56abf45094709d370bd49cfe
BLAKE2b-256 8138093e34c8c0e8bf59563e7023cdf689019e4f9db250d79d81c48364695216

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page