Skip to main content

Perceptually uniform colormaps by Fabio Crameri

Project description

Python package

Python 3.6 Python 3.7 Python 3.8 Python 3.9 Python 3.10 Python 3.11

Downloads (PyPI)

Conda Downloads (conda-forge)

cmcrameri

This is a Python wrapper around Fabio Crameri's perceptually uniform colormaps.

https://www.fabiocrameri.ch/colourmaps/

All credit for creating the colormaps to Fabio. Any errors in the Python implementation of colormaps are my own.

This version is based on Scientific colour maps version 7.0 (02.02.2021).

Install

With pip:

python -m pip install cmcrameri

With conda:

conda install -c conda-forge cmcrameri

Usage example

import cmcrameri.cm as cmc
import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0, 1, 100)[np.newaxis, :]

plt.imshow(x, aspect='auto', cmap=cmc.batlow)
plt.axis('off')
plt.show()

Alternatively, the registered name string can be used.

import cmcrameri # required in order to register the colormaps with Matplotlib
...
plt.imshow(x, aspect='auto', cmap='cmc.batlow')

Extra instructions

You can access all the core colormaps from Fabio Crameri's list by cmcrameri.cm.<colormapname>.

You can use tab autocompletion on cmcrameri.cm if your editor supports it.

For a reversed colormap, append _r to the colormap name.

Categorical colormaps have the suffix S.

For an image of all the available colormaps without leaving the comfort of your Python session:

from cmcrameri import show_cmaps

show_cmaps()

Figure demonstrating the colormaps

The original colormap text files are shipped as part of the package. Find them on your system with:

from cmcrameri.cm import paths

paths

License

This work is licensed under an MIT license.

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

cmcrameri-1.6.tar.gz (258.1 kB view details)

Uploaded Source

Built Distribution

cmcrameri-1.6-py3-none-any.whl (270.5 kB view details)

Uploaded Python 3

File details

Details for the file cmcrameri-1.6.tar.gz.

File metadata

  • Download URL: cmcrameri-1.6.tar.gz
  • Upload date:
  • Size: 258.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for cmcrameri-1.6.tar.gz
Algorithm Hash digest
SHA256 739300c3109eba37c56c3ad952863605635986e65c04b7ec3d9bbd19d760eedb
MD5 cfc44f084c3e6989c125f777519b14a9
BLAKE2b-256 266192bbfc51245922cdb443f1c830c2b0b03d777626921fc33d2faadc42a62c

See more details on using hashes here.

File details

Details for the file cmcrameri-1.6-py3-none-any.whl.

File metadata

  • Download URL: cmcrameri-1.6-py3-none-any.whl
  • Upload date:
  • Size: 270.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for cmcrameri-1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 2cc4d6f1083ef29aeddaddaab77bc1ebb86c59eb97d5755bbfa5c1666444543d
MD5 bb7f073b21e118fef03dbe6b4175bd7d
BLAKE2b-256 5a702236c3077d1f1e01a531cb1e7f4da487a37cb23a4ac13f86d66599dd5a7d

See more details on using hashes here.

Supported by

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