Eighteen color maps. Sequential, diverging, and categorical options. Perceptually uniform, CVD-safe, and grayscale-readable.
Why duckmapR
Every palette in duckmapR is designed in perceptual color space and rigorously optimized with CIEDE2000 diagnostics, so equal steps in the data produce smooth, ordered visual changes.
Color maps are designed in perceptual color space, then resampled with CIEDE2000 so equal steps in the data produce even visual progression.
Each color map is optimized against diagnostic criteria for lightness, perceptual-step uniformity, CVD and grayscale readability, and sRGB fidelity.
Palettes are evaluated under protanopia, deuteranopia, and tritanopia simulations to reduce color-dependent ambiguity and preserve readable contrast.
Every sequential and categorical color map converts gracefully to grayscale, ensuring your figures are accessible in print and across displays.
Use duckmapR directly in ggplot2 with drop-in functions for continuous, discrete, and categorical color scales.
The color maps
duckmapR includes sequential, diverging, and categorical color maps for your data visualization needs. All palettes share a Mallard-inspired visual language — anchored in deep greens, warm browns and neutrals, and muted blues — while preserving enough range to choose the right map for the figure.
Vivid variants expand chroma by 10–35% for each sequential color map, preserving its identity while adding saturation when you need it.
Pairwise CVD ΔE validated. All seven colors maintain perceptual distinctiveness under deuteranopia, protanopia, and tritanopia simulation.
Usage
Pick any color map and see it applied to example plots. Toggle color-vision-deficiency simulation to see how it holds up, switch between standard and vivid styles, then copy the code and apply it to your data.
Illustrated previews are drawn in JavaScript to approximate how each color map reads on common chart types. Continuous colors are interpolated in CIELAB to mirror the package's Lab-space construction. CVD simulation uses a standard dichromat transform.
Build your own
Looking for something a little different? Shape a sequential color map directly in Lab space, then read the same perceptual diagnostics duckmapR is built on, with metrics updating live as you interact with the plot. When you're satisfied, use the export function to use your own custom color map in duckmapR.
The Status verdict reflects the worst case across normal vision, all three CVD simulations, and grayscale, with sensitivity to core failure modes such as lightness order, lightness span, perceptual flat spots, adjacent separation, and gamut or anchor clipping. Diagnostics are computed on 256 Lab-interpolated samples after applying the selected viewing condition. ΔE₀₀ thresholds are heuristics that depend on display, background, and other factors. CVD simulation uses standard dichromat approximation matrices.
API reference
| Function | Purpose | Key arguments |
|---|---|---|
| duckmap() | Return a character vector of n hex colors interpolated from the requested palette. Type is resolved from the palette name by default. | palette name · type "all" / "seq" / "div" / "cat" · n integer · reverse · style "standard" / "vivid" · colors |
| duckmap_summary() | Draw a visual summary strip and return color-map metadata (name, type, default flag, default n, available styles) as a data frame. Use plot = FALSE for the metadata without drawing. |
type · plot logical · style "standard" / "vivid" |
| duckmap_custom() | Build a custom continuous color map from CIELAB anchors. Returns an object usable directly with duckmap() and the ggplot2 scale helpers. |
anchors data frame (t, L, a, b) · name |
| scale_fill_duckmap() | ggplot2 fill scale for continuous, discrete, or categorical data. | palette · type · discrete · reverse · style · colors · passes ... to ggplot2 |
| scale_color_duckmap() | ggplot2 color (colour) scale — same interface as scale_fill_duckmap. scale_colour_duckmap is an alias. |
palette · type · discrete · reverse · style · colors · passes ... to ggplot2 |
Installation
Requires R ≥ 4.1.0. Easy to integrate with ggplot2. No extra setup needed.