Skip to contents

draw_key_watercolor() draws a legend key as a small painted swatch, with the same settings as the layer it describes. It is the default key of the watercolor fill geoms, such as geom_sf_watercolor() and geom_col_watercolor().

Usage

draw_key_watercolor(data, params, size)

Arguments

data

A single row data frame containing the scaled aesthetics to display in this key

params

A list of additional parameters supplied to the geom.

size

Width and height of key in mm.

Value

A grob.

Examples

library(ggplot2)

ggplot(mpg, aes(class, fill = drv)) +
  geom_col_watercolor(stat = "count", seed = 1) +
  theme_paper()


# Use a flat key instead
ggplot(mpg, aes(class, fill = drv)) +
  geom_col_watercolor(stat = "count", seed = 1, key_glyph = "rect") +
  theme_paper()