Maps a discrete variable to drawing media (see sketch_media()) when it is
mapped with aes(medium = ) on a path-like sketch geom
(geom_sketch_line(), geom_sketch_path(), geom_sketch_segment(),
geom_sketch_step()). Because of its name, ggplot2 picks it up automatically;
you only need to call it directly to choose which media to use or to set
legend options.
Arguments
- ...
Passed to
ggplot2::discrete_scale()(e.g.name,labels,guide).- media
Character vector of media to cycle through, each one of
sketch_media(). Defaults to every medium except"pen"(so mapped levels look distinct); recycled with a warning if there are more levels than media.
Details
Each group is drawn in a single medium, so map medium to the same variable
you group by (often colour or group).
See also
Other sketch-media:
sketch_media()
Examples
library(ggplot2)
df <- data.frame(
x = rep(1:10, 3),
y = c(1:10, (1:10) + 4, (1:10) + 8),
g = rep(c("a", "b", "c"), each = 10)
)
ggplot(df, aes(x, y, group = g, medium = g, colour = g)) +
geom_sketch_line(linewidth = 1, seed = 1L) +
scale_medium_discrete() +
theme_sketch()
