Map a discrete variable to fill textures – the greyscale- and
colour-vision-safe companion of a fill palette – via a filled mark's pattern
aesthetic: mark_bar(x = g, y = n, pattern = series). Each level takes a
distinct pattern_stripe()-family texture. Applies to the filled marks (bar,
area, tile, rect, boxplot, violin, hull).
Arguments
- plot
A PlotSpec.
- values
Optional textures, one per level: a character vector of builder names (
"stripe","crosshatch","grid","dot","checker"), or a list ofvellum_patternobjects (e.g. frompattern_stripe()).NULL(default) cycles a built-in palette of distinct textures.- name
Optional legend title.
Value
The modified PlotSpec.
Examples
df <- data.frame(g = c("a", "b", "c"), n = c(3, 5, 2))
vplot(df) |> mark_bar(x = g, y = n, pattern = g) |> scale_pattern()
