Perceptually uniform colormaps by Fabio Crameri
Maintained. Last release 4 months ago, commits in 2 of the last 26 weeks. Weaker on commit activity and release cadence.
pip install cmcramericmcrameri
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')
