Catalog Module

The catalog module provides access to over 240 carefully curated color gradients from popular libraries including matplotlib, Plotly, and Palettable.

Catalog Access

The main catalog object provides organized access to over 240 color gradients:

from chromo_map import cmaps

# Access different catalog sources
mpl_maps = cmaps.matplotlib_by_type
plotly_maps = cmaps.plotly_by_type
palettable_maps = cmaps.palettable_by_type

# Access all maps in a flat structure
all_maps = cmaps.all

# Example: Get a specific gradient
viridis = cmaps.all['viridis']
plasma = cmaps.all['plasma']

The catalog is organized by source and type, making it easy to discover and access color palettes from different libraries.

Matplotlib Integration

Access matplotlib’s extensive colormap collection:

from chromo_map import cmaps

# Browse matplotlib categories
print(list(cmaps.matplotlib.keys()))
# Output: ['Perceptually Uniform Sequential', 'Sequential', 'Diverging', ...]

# Access specific categories
sequential = cmaps.matplotlib['Sequential']
diverging = cmaps.matplotlib['Diverging']

# Get specific colormaps
viridis = cmaps.matplotlib['Perceptually Uniform Sequential']['viridis']
plasma = cmaps.matplotlib['Perceptually Uniform Sequential']['plasma']

Plotly Color Scales

Access Plotly’s beautiful color scales:

from chromo_map import cmaps

# Browse Plotly scales
print(list(cmaps.plotly.keys()))

# Access specific scales
plotly_viridis = cmaps.plotly['Viridis']
plotly_plasma = cmaps.plotly['Plasma']

# Plotly categorical scales
plotly_set1 = cmaps.plotly['Set1']

Palettable Collections

Access curated palettes from the Palettable library:

from chromo_map import cmaps

# Browse Palettable collections
print(list(cmaps.palettable.keys()))
# Output: ['cartocolors', 'colorbrewer', 'scientific', ...]

# Access ColorBrewer palettes
colorbrewer = cmaps.palettable['colorbrewer']

# Scientific color palettes
scientific = cmaps.palettable['scientific']

Catalog Organization

The catalog is hierarchically organized:

cmaps/
├── matplotlib/
│   ├── Perceptually Uniform Sequential/
│   │   ├── viridis
│   │   ├── plasma
│   │   └── ...
│   ├── Sequential/
│   └── Diverging/
├── plotly/
│   ├── Viridis
│   ├── Plasma
│   └── ...
└── palettable/
    ├── colorbrewer/
    ├── scientific/
    └── cartocolors/

Search and Discovery

Multiple ways to find the perfect colormap:

Direct Access

# If you know exactly what you want
viridis = cmaps.matplotlib['Perceptually Uniform Sequential']['viridis']

Search Function

from chromo_map import get_gradient

# Flexible search with patterns
viridis = get_gradient('viridis')  # Exact match
blues = get_gradient('blue.*')     # Regex pattern
any_plasma = get_gradient('plasma', case_sensitive=False)

Browsing

# Explore available options
for category in cmaps.matplotlib:
    print(f"Category: {category}")
    for name in list(cmaps.matplotlib[category].keys())[:3]:
        print(f"  - {name}")

Catalog Properties

Lazy Loading

Color maps are loaded only when accessed, keeping memory usage low.

Automatic Conversion

All colormaps are automatically converted to chromo-map Gradient objects.

Consistent Interface

Regardless of source (matplotlib, Plotly, Palettable), all gradients have the same interface.

Rich Metadata

Each gradient includes information about its source, length, and characteristics.

Working with Gradients

Once you have a gradient from the catalog, you can use all chromo-map features:

from chromo_map import get_gradient

# Get a gradient
viridis = get_gradient('viridis')

# Use chromo-map features
reversed_viridis = viridis.reverse()
shorter_viridis = viridis.resample(50)

# Access individual colors
start_color = viridis[0]
end_color = viridis[-1]

# Create variations
darker_viridis = viridis.adjust_brightness(-0.2)

Catalog Statistics

The catalog contains:

  • Matplotlib: 100+ colormaps across 8 categories

  • Plotly: 20+ built-in color scales

  • Palettable: 200+ curated scientific and cartographic palettes

  • Total: 300+ high-quality color gradients

Integration Examples

The catalog integrates seamlessly with plotting libraries:

import matplotlib.pyplot as plt
from chromo_map import get_gradient

# Use with matplotlib
gradient = get_gradient('viridis')
plt.imshow(data, cmap=gradient.to_mpl())

# Use with plotly
import plotly.graph_objects as go
colors = [color.hex for color in gradient]
fig = go.Figure(data=go.Scatter(y=data, marker=dict(color=colors)))

This makes chromo-map a powerful bridge between different color libraries and visualization tools.