Skip to main content

cmcrameri

Project Status: Active – The project has reached a stable, usable state and is being actively developed.

python versions

pypi Downloads

anaconda badge Conda Downloads

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 8.0 (2023-06-14).

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

For a discretized colormap like batlow split into 25 levels, you can use the .resampled method on any of the colormaps:

plt.imshow(x, aspect='auto', cmap=cmc.batlow.resampled(25))

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.

Usage

Stargazers over time

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.10.tar.gz (260.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cmcrameri-1.10-py3-none-any.whl (277.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cmcrameri-1.10.tar.gz
  • Upload date:
  • Size: 260.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cmcrameri-1.10.tar.gz
Algorithm Hash digest
SHA256 38a776359040674cb4028695faf0121d0ccadb40eee0c9834eb4947674962b7e
MD5 d3a907f3611b5cbdfb21b99b81c72621
BLAKE2b-256 949e43d76a835977e9d1b5cb1f9524004055c2d66a12406f91ef7262c83d1631

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cmcrameri-1.10-py3-none-any.whl
  • Upload date:
  • Size: 277.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cmcrameri-1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 0ccc9970fe35d74543bb8aeca5a5a97d8a09de71d2237d1bb714c9968cc2018d
MD5 6053558cdb7ce9ba2a9fb3e127f4b1fb
BLAKE2b-256 831724e1d6d7a882a15fed5dcf7528891c9782613fd9a2ebe1bb426f4f1ef581

See more details on using hashes here.

Supported by

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