Skip to main content

Scientific colormaps for making stunning and 'cmashing' plots

Project description

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

Description

This package contains a collection of scientific colormaps for making stunning and cmashing plots, showcased in the online documentation. The colormaps in CMasher are all designed to be perceptually uniform sequential, most of them are color vision deficiency (CVD; colorblind) 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 here, 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.

Colormap overview

Below is an overview of all the colormaps that are currently in CMasher. For more information, see the online documentation.

CMasher Colormap Overview

Installation & Use

How to install

CMasher can be found in the PyPI system, so pip install cmasher should suffice.

Example use

The colormaps shown above can be accessed by simply importing CMasher (which automatically executes the import_cmaps function on the cmasher/colormaps directory). This makes them available in CMasher’s cm 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
cmap = cmr.rainforest

# Access rainforest colormap through MPL
# CMasher colormaps in MPL have an added 'cmr.' prefix
cmap = 'cmr.rainforest'

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

Accessing the colormaps in other packages than matplotlib would require reading in the text-files in the cmasher/colormaps directory, which contain the normalized RGB values (multiply by 255 for regular 8-bit values) of every colormap, and registering them in the package manually. For those that are interested, the viscm source files that were used for creating the colormaps can also be found in the cmasher/colormaps directory in the repo (the source files are not provided with the package distribution).

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

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cmasher-1.1.4-py3-none-any.whl (232.7 kB view details)

Uploaded Python 3

cmasher-1.1.4-py2-none-any.whl (232.7 kB view details)

Uploaded Python 2

File details

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

File metadata

  • Download URL: cmasher-1.1.4.tar.gz
  • Upload date:
  • Size: 228.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/2.7.15

File hashes

Hashes for cmasher-1.1.4.tar.gz
Algorithm Hash digest
SHA256 4f59dc12754e6121ce12df235bea04f2ba8550f411d6755ec3b71829148fdc07
MD5 0b3900352fed6aabf97d52ba31a3f70f
BLAKE2b-256 c2d74f080cce03acc187678a3d84b5078fb28e81daec71726301b4a5fabd6505

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cmasher-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 232.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.1

File hashes

Hashes for cmasher-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 097098b69e38bbae25269c1c43ba2d5275585354735ea4fa68fff2780b108eac
MD5 c593ea73e141fc9b1e074ecfb567da9d
BLAKE2b-256 1effbde376f2bba3087745da8d3a58b13bf63180cf2572e3fd46e4d707318d9e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cmasher-1.1.4-py2-none-any.whl
  • Upload date:
  • Size: 232.7 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/2.7.15

File hashes

Hashes for cmasher-1.1.4-py2-none-any.whl
Algorithm Hash digest
SHA256 a4b6c8bc56c473456e3c0925377cfdab51e85e2558adfc7002f90653256e446b
MD5 df6f44aaa9699581d3cc525f8815287f
BLAKE2b-256 f97f1adb173ed5b6180be9c2b400014abdff23c06db80eabf4b143a1bb2425ce

See more details on using hashes here.

Supported by

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