scale_fill_wolves: Fill scale constructor for wwfc colours

Description Usage Arguments Examples

View source: R/palettes.R

Description

Custom fill scale functions for ggplot2. Handles discrete or continuous scales.

Usage

1
2
3
4
5
6
scale_fill_wolves(
  palette = "wooly_bully",
  discrete = TRUE,
  reverse = FALSE,
  ...
)

Arguments

palette

Character name of palette in wwfc_palettes

discrete

Boolean indicating whether fill aesthetic is discrete or not

reverse

Boolean indicating whether the palette should be reversed

...

Additional arguments passed to discrete_scale() or scale_fill_gradientn() according to whether discrete arg is TRUE or FALSE

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Fill by discrete variable with different palette + remove legend (guide)
# Note: you will probably want to avoid using colour in this way!
library(ggplot2)
ggplot(mpg, aes(manufacturer, fill = manufacturer)) +
  geom_bar() +
  wolves_theme(grid = "vgrid") +
  coord_flip() +
  scale_y_continuous(expand = expansion(mult = c(0, 0.05))) +
  scale_fill_wolves(palette = "wooly_bully", guide = "none") +
  labs(title = "scale_fill_wolves() can generate many colours from a palette",
       subtitle = "Using colour in this way (despite consistent data type) is not recommended!")

lizardburns/wwplot documentation built on Jan. 5, 2022, 12:26 a.m.