CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-cmasher

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

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Eval results
Files

colormap-collections.mddocs/

Colormap Collections

CMasher provides 53 scientifically designed colormaps organized by type. All colormaps are perceptually uniform, color-vision deficiency friendly, and available in both normal and reversed versions. Cyclic colormaps also include shifted variants.

Capabilities

Sequential Colormaps

Colormaps that transition smoothly from one color to another, ideal for representing ordered data with a natural progression.

# Available sequential colormaps (37 total)
cmrcm.amber       # ListedColormap
cmrcm.amethyst    # ListedColormap  
cmrcm.apple       # ListedColormap
cmrcm.arctic      # ListedColormap
cmrcm.bubblegum   # ListedColormap
cmrcm.chroma      # ListedColormap
cmrcm.cosmic      # ListedColormap
cmrcm.dusk        # ListedColormap
cmrcm.eclipse     # ListedColormap
cmrcm.ember       # ListedColormap
cmrcm.emerald     # ListedColormap
cmrcm.fall        # ListedColormap
cmrcm.flamingo    # ListedColormap
cmrcm.freeze      # ListedColormap
cmrcm.gem         # ListedColormap
cmrcm.ghostlight  # ListedColormap
cmrcm.gothic      # ListedColormap
cmrcm.horizon     # ListedColormap
cmrcm.jungle      # ListedColormap
cmrcm.lavender    # ListedColormap
cmrcm.lilac       # ListedColormap
cmrcm.neon        # ListedColormap
cmrcm.neutral     # ListedColormap
cmrcm.nuclear     # ListedColormap
cmrcm.ocean       # ListedColormap
cmrcm.pepper      # ListedColormap
cmrcm.rainforest  # ListedColormap
cmrcm.sapphire    # ListedColormap
cmrcm.savanna     # ListedColormap
cmrcm.sepia       # ListedColormap
cmrcm.sunburst    # ListedColormap
cmrcm.swamp       # ListedColormap
cmrcm.torch       # ListedColormap
cmrcm.toxic       # ListedColormap
cmrcm.tree        # ListedColormap
cmrcm.tropical    # ListedColormap
cmrcm.voltage     # ListedColormap

Usage Example

import matplotlib.pyplot as plt
import numpy as np
import cmasher.cm as cmrcm

# Use sequential colormap for heatmap
data = np.random.rand(10, 10)
plt.imshow(data, cmap=cmrcm.rainforest)
plt.colorbar(label='Values')
plt.title('Sequential Colormap Example')
plt.show()

Diverging Colormaps

Colormaps with a neutral central color and contrasting colors at the extremes, perfect for data with a meaningful midpoint or zero value.

# Available diverging colormaps (12 total)
cmrcm.fusion      # ListedColormap
cmrcm.guppy       # ListedColormap
cmrcm.holly       # ListedColormap
cmrcm.iceburn     # ListedColormap
cmrcm.pride       # ListedColormap
cmrcm.prinsenvlag # ListedColormap
cmrcm.redshift    # ListedColormap
cmrcm.seaweed     # ListedColormap
cmrcm.viola       # ListedColormap
cmrcm.waterlily   # ListedColormap
cmrcm.watermelon  # ListedColormap
cmrcm.wildfire    # ListedColormap

Usage Example

import matplotlib.pyplot as plt
import numpy as np
import cmasher.cm as cmrcm

# Use diverging colormap for correlation matrix
data = np.random.randn(10, 10)
correlation = np.corrcoef(data)
plt.imshow(correlation, cmap=cmrcm.iceburn, vmin=-1, vmax=1)
plt.colorbar(label='Correlation')
plt.title('Diverging Colormap Example')
plt.show()

Cyclic Colormaps

Colormaps that wrap around seamlessly, suitable for periodic data like angles, phases, or time-of-day.

# Available cyclic colormaps (4 total)
cmrcm.copper     # ListedColormap
cmrcm.emergency  # ListedColormap
cmrcm.infinity   # ListedColormap
cmrcm.seasons    # ListedColormap

Usage Example

import matplotlib.pyplot as plt
import numpy as np
import cmasher.cm as cmrcm

# Use cyclic colormap for angular data
theta = np.linspace(0, 2*np.pi, 100)
r = np.linspace(0, 1, 50)
T, R = np.meshgrid(theta, r)
data = np.sin(3*T)

plt.subplot(projection='polar')
plt.pcolormesh(T, R, data, cmap=cmrcm.seasons)
plt.colorbar(label='Phase')
plt.title('Cyclic Colormap Example')
plt.show()

Reversed and Shifted Versions

All colormaps have reversed versions (with _r suffix) and cyclic colormaps have shifted versions (with _s suffix).

# Reversed versions
cmrcm.rainforest_r  # ListedColormap - reversed rainforest
cmrcm.iceburn_r     # ListedColormap - reversed iceburn
cmrcm.seasons_r     # ListedColormap - reversed seasons

# Shifted versions (cyclic only)
cmrcm.seasons_s     # ListedColormap - shifted seasons
cmrcm.copper_s      # ListedColormap - shifted copper
cmrcm.emergency_s   # ListedColormap - shifted emergency
cmrcm.infinity_s    # ListedColormap - shifted infinity

# Reversed + shifted versions (cyclic only)
cmrcm.seasons_s_r   # ListedColormap - reversed shifted seasons
cmrcm.copper_s_r    # ListedColormap - reversed shifted copper
cmrcm.emergency_s_r # ListedColormap - reversed shifted emergency
cmrcm.infinity_s_r  # ListedColormap - reversed shifted infinity

Colormap Access Patterns

# Direct access to individual colormaps
import cmasher.cm as cmrcm
colormap = cmrcm.rainforest

# Access via matplotlib
import matplotlib.pyplot as plt
plt.imshow(data, cmap='cmr.rainforest')

# Access via cmasher utility
import cmasher as cmr
import matplotlib as mpl
colormap = mpl.colormaps['cmr.rainforest']

Colormap Collections

import cmasher.cm as cmrcm

# All colormaps dictionary
cmrcm.cmap_d: dict[str, ListedColormap]
# Dictionary with all colormap objects keyed by name

# Categorized colormaps dictionary  
cmrcm.cmap_cd: dict[str, dict[str, ListedColormap]]
# Nested dictionary organized by type:
# - cmrcm.cmap_cd['sequential']: dict[str, ListedColormap]
# - cmrcm.cmap_cd['diverging']: dict[str, ListedColormap] 
# - cmrcm.cmap_cd['cyclic']: dict[str, ListedColormap]
# - cmrcm.cmap_cd['qualitative']: dict[str, ListedColormap]
# - cmrcm.cmap_cd['misc']: dict[str, ListedColormap]

Usage Example

import cmasher.cm as cmrcm

# Get all sequential colormaps
sequential_cmaps = cmrcm.cmap_cd['sequential']
print(f"Available sequential colormaps: {len(sequential_cmaps)}")

# Iterate through all diverging colormaps
for name, cmap in cmrcm.cmap_cd['diverging'].items():
    print(f"Diverging colormap: {name}")

# Access specific colormap from collection
ocean_cmap = cmrcm.cmap_d['ocean']

Install with Tessl CLI

npx tessl i tessl/pypi-cmasher

docs

cli-tools.md

color-analysis.md

colormap-collections.md

index.md

integration.md

manipulation.md

registration.md

visualization.md

tile.json