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

Release files for cmcrameri 1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cmcrameri 1.10
File Size Uploaded
cmcrameri-1.10.tar.gz 260.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cmcrameri 1.10
File Interpreter ABI Platform
cmcrameri-1.10-py3-none-any.whl Python 3 none any Details

Total release size: 538.3 kB

Release files / cmcrameri-1.10.tar.gz

Download URL cmcrameri-1.10.tar.gz
Size 260.6 kB
Tags Source
SHA-256 checksum
How to use checksums
38a776359040674cb4028695faf0121d0ccadb40eee0c9834eb4947674962b7e
BLAKE2b-256 checksum
How to use checksums
949e43d76a835977e9d1b5cb1f9524004055c2d66a12406f91ef7262c83d1631
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / cmcrameri-1.10-py3-none-any.whl

Download URL cmcrameri-1.10-py3-none-any.whl
Size 277.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0ccc9970fe35d74543bb8aeca5a5a97d8a09de71d2237d1bb714c9968cc2018d
BLAKE2b-256 checksum
How to use checksums
831724e1d6d7a882a15fed5dcf7528891c9782613fd9a2ebe1bb426f4f1ef581
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

1.10 This release

2 release files

1.9

2 release files

1.8

2 release files

1.7

2 release files

1.6

2 release files

1.5

1 release file

1.4

2 release files

1.3

1 release file

1.2

2 release files

1.1

1 release file

0.12

1 release file

0.11

1 release file

0.10

1 release file

0.9

1 release file

0.8

1 release file

0.7

1 release file

0.6

1 release file

0.5

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page