# \donttest{
library(ggplot2)
library(fillpattern)
ggplot(mpg, aes(x = class, y = hwy, color = class, fill = class)) +
geom_boxplot() +
scale_fill_pattern()
ggplot(mpg, aes(x = drv, y = hwy, color = drv, fill = drv)) +
geom_violin() +
scale_colour_brewer(palette = "Set1") +
scale_fill_pattern(c("brick", "stripe45", "grid45_lg"), fg = "black")
ggplot(mpg, aes(x = drv, color = drv, fill = drv)) +
geom_bar() +
scale_fill_pattern(
patterns = c("hex_sm", "brick90_xl", "fish"),
lty = c("solid", "twodash", "dotted"),
lwd = c(2, 3, 1) ) +
theme(legend.key.size = unit(2, 'cm'))
# }
Run the code above in your browser using DataLab