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

Metadata

Release files for cmcrameri 2.0.0

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 2.0.0
File Size Uploaded Provenance Actions
cmcrameri-2.0.0.tar.gz 292.1 kB Without provenance Details for cmcrameri-2.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 591.3 kB

Release files / cmcrameri-2.0.0.tar.gz

Download URL cmcrameri-2.0.0.tar.gz
Size 292.1 kB
Tags Source
SHA-256 checksum
How to use checksums
cebb81a7add4777e0b7f1bd9995184ba7f8b2accb9ee8b3019a4265b7e6ee117
BLAKE2b-256 checksum
How to use checksums
26a0dc4789bf587ef518534c752a380bad386578586155e20aa0a7dfb9a93958
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

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

Download URL cmcrameri-2.0.0-py3-none-any.whl
Size 299.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
096ae4e6aad9b0776bfbf60e164a87adff54847e90ad0121ef0e7016d00d540d
BLAKE2b-256 checksum
How to use checksums
1e9c6536f069ad092e57bb42cd5a40df19d8f5ddb297c3364c61b8bb9c31b91a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for cmcrameri 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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