Skip to contents

An identity scale for the pattern aesthetic: the data column's values are interpreted directly as pattern names with no remapping. Use this when the variable mapped to pattern already contains valid pattern names (e.g. "hatch", "dots").

Usage

scale_pattern_identity(..., guide = "legend")

Arguments

...

Passed to ggplot2::scale_discrete_identity().

guide

Legend guide. Defaults to "none" because identity scales typically don't need a legend; pass "legend" to show one.

Examples

library(ggplot2)
df <- data.frame(
  group = c("hatch", "dots", "crosshatch"),
  value = c(3, 5, 4)
)
ggplot(df, aes(group, value, fill = group, pattern = group)) +
  geom_col_pattern() +
  scale_pattern_identity()