plasma - Filling with noiseArray-based patterns allow the user to specify an RGBA that should be displayed in the geom.
Imagemagick (magick) has the ability to generate some fractal noise arrays, and for this pattern, these arrays are coloured and used to fill the geom.
plasma options| Aesthetic | Description | Default |
|---|---|---|
pattern_fill |
Noise colour | ‘grey80’ |
pattern_scale |
Extra scaling | 1 |
pattern_alpha |
Alpha | NA |
pattern_aspect_ratio |
Override aspect ratio | NA |
pattern_key_scale_factor |
Additional scale factor for legend | 1 |
df1 <- data.frame(
trt = c("a", "b", "c"),
outcome = c(2.3, 1.9, 3.2)
)pattern = 'plasma' - With pattern_alpha
ggplot(df1, aes(trt, outcome)) +
geom_col_pattern(
aes(
fill = trt,
pattern_fill = trt
),
fill = NA,
pattern = 'plasma',
pattern_alpha = 1,
pattern_scale = 2,
colour = 'black'
) +
theme_bw(15) +
labs(
title = "ggpattern::geom_col_pattern()",
subtitle = "pattern='plasma'"
) +
theme(legend.key.size = unit(1.5, 'cm')) +
coord_fixed(ratio = 1/2)
pattern = 'plasma' - With pattern_alpha
ggplot(mtcars) +
geom_density_pattern(
aes(
x = mpg,
pattern_fill = as.factor(cyl)
),
pattern = 'plasma',
pattern_alpha = 0.7
) +
theme_bw(15) +
theme(legend.position = 'none') +
labs(
title = "ggpattern::geom_density_pattern()",
subtitle = "pattern='plasma'"
) +
coord_fixed(ratio = 80)