Skip to contents

ggwatercolor is a ggplot2 extension that draws maps and charts in the style of watercolor paint. The first model for the package was the archival map, where a soft tint follows each coastline and the open sea stays white.

The package has four parts:

Installation

Install the development version from GitHub:

# install.packages("pak")
pak::pak("kjhealy/ggwatercolor")

ggwatercolor needs ggplot2 4.0.0 or later.

A watercolor map

The package includes hawaii, the outlines of the eight main Hawaiian islands. Each watercolor layer draws only paint. Add geom_sf() with fill = NA to draw the outlines.

library(ggplot2)
library(ggwatercolor)

ggplot(hawaii) +
  geom_sf_watercolor(seed = 1929) +
  geom_sf_wash(seed = 1929) +
  geom_sf(fill = NA, colour = "#5E4A36", linewidth = 0.25) +
  theme_paper_void()

Map of the eight main Hawaiian islands on off-white paper. Each island has a mottled brown fill and a thin dark outline. A blue wash follows each coast and fades to bare paper a short distance offshore.

The wash and the paint use random noise. Set seed to get the same picture each time.

Paint each feature or each fill

geom_sf_watercolor() paints each feature separately by default. Each feature gets its own darker rim, and thin gaps of paper can show between neighbours. Use by = "fill" to paint all features of one colour as a single area.

library(patchwork)

nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
nc$region <- cut(sf::st_coordinates(sf::st_centroid(sf::st_geometry(nc)))[, 1], 4)

nc_map <- function(by) {
  ggplot(nc) +
    geom_sf_watercolor(aes(fill = region), by = by, seed = 1) +
    geom_sf_wash(data = sf::st_union(nc), seed = 1) +
    geom_sf(fill = NA, colour = "#5E4A36", linewidth = 0.12) +
    scale_fill_manual(values = c("#B9794F", "#CC7F8E", "#7FA07A", "#D9B25A")) +
    labs(title = paste0("by = \"", by, "\"")) +
    theme_paper_void() +
    theme(legend.position = "none")
}

nc_map("feature") / nc_map("fill") + plot_annotation(theme = theme_paper_void())

Two maps of North Carolina counties, coloured in four regions from west to east. The top map shows separate paint for each county, with a darker rim around each county. In the bottom map each region is one continuous area of paint. Both maps have a blue wash along the outside of the state.

Relief

geom_hachure() shows the shape of the land with hachures, in the manner of engraved maps. The layer needs a raster of elevation. hawaii_elevation() reads an example raster.

ggplot(hawaii) +
  geom_hachure(hawaii_elevation(), seed = 1929) +
  geom_sf_wash(seed = 1929) +
  geom_sf(fill = NA, colour = "#7A4A2A", linewidth = 0.25) +
  coord_sf(xlim = c(-158.4, -155.9), ylim = c(20.45, 21.8)) +
  theme_paper_void()

Map of the islands from Oahu to Maui. Fine brown lines run down the slopes of each island from the high ground to the coast. The lines are dense and dark on steep mountains and absent on level plains. A blue wash follows each coast.

Set light to a compass bearing to light the land from one side. The lines become thinner on slopes that face the light and heavier on slopes that face away. This map puts the light in the north-west.

ggplot(hawaii) +
  geom_hachure(hawaii_elevation(), light = 315, seed = 1929) +
  geom_sf_wash(seed = 1929) +
  geom_sf(fill = NA, colour = "#7A4A2A", linewidth = 0.25) +
  coord_sf(xlim = c(-158.4, -155.9), ylim = c(20.45, 21.8)) +
  theme_paper_void()

Map of the islands from Oahu to Maui with hachures lit from the north-west. The lines on the south and east slopes of each mountain are heavy and dark. The lines on the north and west slopes are thin and pale. A blue wash follows each coast.

Each map layer accepts monochrome = TRUE, which gives the same picture in grey.

ggplot(hawaii) +
  geom_hachure(hawaii_elevation(), monochrome = TRUE, seed = 1929) +
  geom_sf_wash(monochrome = TRUE, seed = 1929) +
  geom_sf(fill = NA, colour = "grey20", linewidth = 0.25) +
  coord_sf(xlim = c(-158.4, -155.9), ylim = c(20.45, 21.8)) +
  theme_paper_void(paper = "#F5F5F5", ink = "grey20")

Map of the islands from Oahu to Maui in shades of grey on pale grey paper. Fine dark grey lines run down the slopes of each island. A grey wash follows each coast.

Charts

The same paint works on ordinary charts. geom_col_watercolor(), geom_area_watercolor(), and geom_density_watercolor() follow geom_col(), geom_area(), and geom_density(). geom_polygon_watercolor() paints any polygon. geom_point_watercolor(), geom_line_watercolor(), and geom_smooth_watercolor() paint points, lines, and smoothed lines.

ggplot(mpg, aes(class, fill = drv)) +
  geom_col_watercolor(stat = "count", seed = 1) +
  scale_fill_manual(values = c("#B9794F", "#4E9DB5", "#D9B25A")) +
  labs(x = NULL, y = "Count", fill = "Drive") +
  theme_paper()

Stacked column chart of car counts by class, with columns painted in brown, blue, and yellow watercolor for three drive types. The legend keys are small painted swatches.

Where painted areas overlap, blend = "multiply" darkens the overlap in the way that layers of pigment do. A lower alpha keeps the overlaps easy to read.

ggplot(mpg, aes(hwy, fill = drv)) +
  geom_density_watercolor(blend = "multiply", alpha = 0.35, seed = 2) +
  scale_fill_manual(values = c("#B9794F", "#4E9DB5", "#D9B25A")) +
  labs(x = "Highway miles per gallon", y = "Density", fill = "Drive") +
  theme_paper()

Three overlapping density curves of highway fuel economy, one for each drive type, painted in brown, blue, and yellow watercolor. The paint is darker where the curves overlap.

How it works

ggwatercolor computes each wash and each fill as a raster image when the device draws the plot. For this reason, the settings that control size are lengths on the page in millimetres. A wash has the same width in a small panel and in a large panel, and in any map projection.