Using Presets
Palettize includes hundreds of colormap presets via the cmap library, plus custom built-in presets.
Listing Presets
Section titled “Listing Presets”See all available presets:
palettize list presetsOr in Python:
from palettize import list_available_presets
presets = list_available_presets()print(f"Found {len(presets)} presets")print(presets[:10]) # First 10Using Presets
Section titled “Using Presets”# Preview a presetpalettize show viridis
# Export a presetpalettize create viridis --format gdal --output viridis.txt --domain 0,255Python
Section titled “Python”from palettize import create_colormap
# From presetcmap = create_colormap(preset="viridis")
# Get colorsprint(cmap.get_color(0)) # Start colorprint(cmap.get_color(0.5)) # Middleprint(cmap.get_color(1)) # End colorPreset Categories
Section titled “Preset Categories”Scientific/Perceptually Uniform
Section titled “Scientific/Perceptually Uniform”These colormaps are designed for accurate data representation:
| Preset | Type | Use Case |
|---|---|---|
viridis | Sequential | General purpose, colorblind-safe |
magma | Sequential | Dark backgrounds |
inferno | Sequential | High contrast |
plasma | Sequential | Good for heatmaps |
cividis | Sequential | Colorblind-optimized |
palettize show viridispalettize show magmapalettize show infernoDiverging
Section titled “Diverging”For data with a meaningful center point:
| Preset | Use Case |
|---|---|
RdBu | Red-Blue, good for temperature |
RdYlBu | Red-Yellow-Blue |
BrBG | Brown-Green, good for terrain |
PiYG | Pink-Green |
PRGn | Purple-Green |
palettize show RdBupalettize show BrBGSequential
Section titled “Sequential”For data with a natural ordering:
| Preset | Character |
|---|---|
Blues | Light to dark blue |
Greens | Light to dark green |
Reds | Light to dark red |
YlOrRd | Yellow-Orange-Red |
YlGnBu | Yellow-Green-Blue |
palettize show Bluespalettize show YlOrRdCategorical/Qualitative
Section titled “Categorical/Qualitative”For discrete categories (use carefully with continuous data):
| Preset | Colors |
|---|---|
Set1 | Bold, distinct |
Set2 | Muted, distinct |
Paired | Paired colors |
tab10 | Tableau 10 |
palettize show Set1palettize show tab10Custom Built-in Presets
Section titled “Custom Built-in Presets”Palettize includes some custom presets prefixed with custom/:
palettize show custom/grayscalepalettize show custom/simple_rgbModifying Presets
Section titled “Modifying Presets”Cut (Sub-segment)
Section titled “Cut (Sub-segment)”Use only part of a preset:
# Skip the dark ends of viridispalettize show viridis --cut "0.1,0.9"
# Use only the first halfpalettize show viridis --cut "0,0.5"Change Interpolation Space
Section titled “Change Interpolation Space”Override the interpolation:
# Use sRGB instead of default oklchpalettize show viridis --space srgbRename
Section titled “Rename”Give a custom name:
palettize create viridis --format gdal --output elev.txt \ --name "Elevation" --domain 0,4000Loading Preset Data
Section titled “Loading Preset Data”Get raw preset data programmatically:
from palettize import load_preset_data
# Returns list of color stopsdata = load_preset_data("viridis")print(data[:3]) # First 3 stopsFinding the Right Preset
Section titled “Finding the Right Preset”By Use Case
Section titled “By Use Case”| Visualization | Recommended Presets |
|---|---|
| Elevation/terrain | terrain, BrBG, YlGnBu |
| Temperature | RdBu, coolwarm, RdYlBu |
| Heatmaps | viridis, magma, inferno |
| Ocean depth | Blues, deep, ocean |
| Vegetation/NDVI | Greens, YlGn, BuGn |
| Population density | YlOrRd, Reds, OrRd |
| Categorical data | Set1, tab10, Paired |
By Characteristic
Section titled “By Characteristic”| Need | Presets |
|---|---|
| Colorblind-safe | viridis, cividis, magma |
| Print-friendly | viridis, gray, bone |
| Perceptually uniform | viridis, magma, inferno, plasma |
| High contrast | inferno, hot, jet |
| Dark background | magma, inferno |
| Light background | viridis, plasma |
The cmap Library
Section titled “The cmap Library”Most presets come from the cmap library, which aggregates colormaps from:
- Matplotlib
- Bokeh
- Plotly
- Seaborn
- Scientific journals
- And more
Browse the full catalog in their documentation to discover more options.
Creating Custom Presets
Section titled “Creating Custom Presets”If you frequently use the same colors, create them directly:
# Define custom colorspalettize show --colors "navy,white,darkred" --name "MyDiverging"
# Or in Pythonfrom palettize import create_colormap
my_cmap = create_colormap( colors=["#001f3f", "#ffffff", "#85144b"], name="NavyWhiteMaroon")For reusable custom presets, consider creating a custom exporter plugin or simply save your preferred color lists.