Skip to main content

Perceptually uniform colormaps by Fabio Crameri

Project description

Python package

Python 3.6 Python 3.7 Python 3.8 Python 3.9

Downloads (PyPI)

Conda Downloads (conda-forge)

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 7.0 (02.02.2021).

Install

With pip:

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

Alternatively, the registered name string can be used.

import cmrameri  # 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.

Project details


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

Uploaded Source

Built Distribution

cmcrameri-1.4-py3-none-any.whl (134.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cmcrameri-1.4.tar.gz
  • Upload date:
  • Size: 116.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for cmcrameri-1.4.tar.gz
Algorithm Hash digest
SHA256 613158db1782754409c073c1b97fa299462ce2cb26c8533e3273b360fd809945
MD5 003173bfcf282a2f9747d01b638dc5ba
BLAKE2b-256 7f56039a1b4f3dcb79e191fcce0a4a952e90936cc20e92dcf709d78f388d9d43

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cmcrameri-1.4-py3-none-any.whl
  • Upload date:
  • Size: 134.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.8

File hashes

Hashes for cmcrameri-1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a92f6fb5f94558b5c11e4868f7bab0f7355266a26beac8f1c937cbaeaa14202f
MD5 c201da9785edf2c08dc96a2771e2dbd2
BLAKE2b-256 959538e801ab9611614377bfc78a661be5622775f0270a69cfc048fe596a8ad6

See more details on using hashes here.

Supported by

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