Skip to main content

Scientific colormaps for making accessible, informative and 'cmashing' plots

Project description

PyPI - Latest Release PyPI - Python Versions Travis CI - Build Status AppVeyor - Build Status ReadTheDocs - Build Status CodeCov - Coverage Status JOSS - Submission Status

CMasher: Scientific colormaps for making accessible, informative and cmashing plots

The CMasher package provides a collection of scientific colormaps to be used by different Python packages and projects, mainly in combination with matplotlib, showcased in the online documentation. The colormaps in CMasher are all designed to be perceptually uniform sequential using the viscm package; most of them are color-vision deficiency friendly; and they cover a wide range of different color combinations to accommodate for most applications. It offers several alternatives to commonly used colormaps, like chroma and rainforest for jet; sunburst for hot; neutral for binary; and fusion and redshift for coolwarm. If you cannot find your ideal colormap, then please open an issue, provide the colors and/or style you want, and I will try to create one to your liking! Let’s get rid of all bad colormaps in the world together!

If you use CMasher for your work, then please star the repo, such that I can keep track of how many users it has and more easily raise awareness of bad colormaps. Additionally, if you use CMasher as part of your workflow in a scientific publication, please consider citing the CMasher paper (BibTeX: cmr.get_bibtex).

Colormap overview

Below is an overview of all the colormaps that are currently in CMasher (made with the cmr.create_cmap_overview() function). For more information, see the online documentation.

CMasher Colormap Overview

Installation & Use

How to install

CMasher can be easily installed by either cloning the repository and installing it manually:

$ git clone https://github.com/1313e/CMasher
$ cd CMasher
$ pip install .

or by installing it directly from PyPI with:

$ pip install cmasher

CMasher can now be imported as a package with import cmasher as cmr.

Example use

The colormaps shown above can be accessed by simply importing CMasher. This makes them available in the cmasher module, in addition to registering them in matplotlib’s cm module (with added 'cmr.' prefix to avoid name clashes). So, for example, if one were to use the rainforest colormap, this could be done with:

# Import CMasher to register colormaps
import cmasher as cmr

# Import packages for plotting
import matplotlib.pyplot as plt
import numpy as np

# Access rainforest colormap through CMasher or MPL
cmap = cmr.rainforest                   # CMasher
cmap = plt.get_cmap('cmr.rainforest')   # MPL

# Generate some data to plot
x = np.random.rand(100)
y = np.random.rand(100)
z = x**2+y**2

# Make scatter plot of data with colormap
plt.scatter(x, y, c=z, cmap=cmap, s=300)
plt.show()

For other use-cases, see the online documentation.

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

cmasher-1.4.2.tar.gz (274.9 kB view details)

Uploaded Source

Built Distributions

cmasher-1.4.2-py3-none-any.whl (281.4 kB view details)

Uploaded Python 3

cmasher-1.4.2-py2-none-any.whl (281.4 kB view details)

Uploaded Python 2

File details

Details for the file cmasher-1.4.2.tar.gz.

File metadata

  • Download URL: cmasher-1.4.2.tar.gz
  • Upload date:
  • Size: 274.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/2.7.15

File hashes

Hashes for cmasher-1.4.2.tar.gz
Algorithm Hash digest
SHA256 fb7b7270bd68c6c9c04d6f5897b9d88f0aa593aa1f95c0c6c977aa973bb6ac7f
MD5 fa9a5e668cc0d18ca51705729ac8ea64
BLAKE2b-256 2453263dc86ecd22b0aed48e4bb2c3bce1e05b448d392fba2f6e0b99536516cb

See more details on using hashes here.

File details

Details for the file cmasher-1.4.2-py3-none-any.whl.

File metadata

  • Download URL: cmasher-1.4.2-py3-none-any.whl
  • Upload date:
  • Size: 281.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.1

File hashes

Hashes for cmasher-1.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3aaa5320bcb55dd36f4a816c552339b08d25d91e5dc11a8302d9e770ea9f4ffa
MD5 84eb77bfd0ca468a725b4c733ade9875
BLAKE2b-256 ea94571b87c426bd384d3ab8844dfeca1e2c4d2ae1102041c77e9edd7b90b6b5

See more details on using hashes here.

File details

Details for the file cmasher-1.4.2-py2-none-any.whl.

File metadata

  • Download URL: cmasher-1.4.2-py2-none-any.whl
  • Upload date:
  • Size: 281.4 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/2.7.15

File hashes

Hashes for cmasher-1.4.2-py2-none-any.whl
Algorithm Hash digest
SHA256 2a927b15cfd3a3fceb2669193259fe38596e079890814e8d57f9f3ad2cdbc9dd
MD5 d7b13ed25130ff878a378f1f8e5096c0
BLAKE2b-256 72b818ea3cc98e6c453d9723b485789c68ed0239361ec0ea2ab3a303dda564be

See more details on using hashes here.

Supported by

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