Pattern fill scales using Cheysson patterns from the Albums de Statistique Graphique. These scales work with ggpattern geoms to apply both colors and hatching patterns.
Usage
scale_pattern_fill_cheysson(palette = "1881_03", reverse = FALSE, ...)
scale_pattern_type_cheysson(palette = "1881_03", reverse = FALSE, ...)
scale_pattern_angle_cheysson(palette = "1881_03", reverse = FALSE, ...)
scale_pattern_density_cheysson(palette = "1881_03", reverse = FALSE, ...)Details
These scales require the ggpattern package. Use with ggpattern geoms like
geom_col_pattern(), geom_bar_pattern(), etc.
The scales apply multiple pattern aesthetics simultaneously:
fill: Base fill colorpattern_type: Type of pattern (none, stripe, crosshatch)pattern_fill: Color of pattern linespattern_angle: Angle of stripespattern_density: Density of pattern lines
Examples
if (FALSE) { # \dontrun{
library(ggplot2)
library(ggpattern)
# Basic bar chart with patterns
ggplot(mpg, aes(class, fill = class)) +
geom_bar_pattern(
aes(
pattern_type = class,
pattern_fill = class,
pattern_angle = class
),
pattern = "stripe",
pattern_density = 0.3,
pattern_spacing = 0.025,
color = "black"
) +
scale_pattern_fill_cheysson("category") +
scale_pattern_type_cheysson("category") +
theme_minimal()
# Use specific palette
ggplot(iris, aes(Species, Sepal.Width, fill = Species)) +
geom_col_pattern(
aes(pattern_type = Species, pattern_fill = Species),
position = "dodge"
) +
scale_pattern_fill_cheysson("1881_03")
} # }
