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 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()
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
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)
| File | Size | Uploaded | |
|---|---|---|---|
| cmcrameri-1.10.tar.gz | 260.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|