MALLARD-INSPIRED SCIENTIFIC COLOR MAPS FOR R

duckmapR

Eighteen color maps. Sequential, diverging, and categorical options. Perceptually uniform, CVD-safe, and grayscale-readable.

Install from GitHub Explore color maps

Why duckmapR

Color maps that just work

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.

Lab-space design

Color maps are designed in perceptual color space, then resampled with CIEDE2000 so equal steps in the data produce even visual progression.

Diagnostic refinement

Each color map is optimized against diagnostic criteria for lightness, perceptual-step uniformity, CVD and grayscale readability, and sRGB fidelity.

CVD friendly

Palettes are evaluated under protanopia, deuteranopia, and tritanopia simulations to reduce color-dependent ambiguity and preserve readable contrast.

Grayscale readable

Every sequential and categorical color map converts gracefully to grayscale, ensuring your figures are accessible in print and across displays.

Built-in ggplot2 support

Use duckmapR directly in ggplot2 with drop-in functions for continuous, discrete, and categorical color scales.

The color maps

A cohesive palette system

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.

Sequential — 11 color maps · standard + vivid styles
full_plumage
bright_mallard
classic_mallard
wetland_dabbler
wing_flash
iridescent
marsh_teal
lake_mist
viriduck
alt_mallard
mottled_plumage
Vivid styles — OPTIONAL CHROMA-EXPANDED SEQUENTIAL VARIANTS FOR ALL SEQUENTIAL MAPS
iridescent standard
iridescent vivid

Vivid variants expand chroma by 10–35% for each sequential color map, preserving its identity while adding saturation when you need it.

Diverging — 6 COLOR MAPS · TRUE-WHITE MIDPOINTS
umber_teal
orange_teal
orange_violet
chestnut_violet
copper_blue
rose_blue
Categorical — 7 colors
archetype
mallard_teal
burnt_orange
chestnut_brown
slate_blue
muted_violet
soft_gold
eggshell

Pairwise CVD ΔE validated. All seven colors maintain perceptual distinctiveness under deuteranopia, protanopia, and tritanopia simulation.

Usage

See it in action

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.

full_plumageSequential
Style
Vision
Reverse
R · usage

      

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

Design your own color map

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

Five functions

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

Get started with one line

Requires R ≥ 4.1.0. Easy to integrate with ggplot2. No extra setup needed.

From GitHub (recommended)

# install.packages("pak") pak::pak("travismallard/duckmapR") # install.packages("devtools") devtools::install_github("travismallard/duckmapR")

From local source tarball

install.packages( "duckmapR_0.1.0.tar.gz", repos = NULL, type = "source" )