Apply a DoE palette to the fill aesthetic
Arguments
- palette
An object of class
palettes_palette. Several useful palettes are ready to use in the listdoe_palettes, which is included with thedoestylepackage. The default isdoe_palettes$qualitative$default, which uses all of the on-brand colours defined in the NSW Department of Education Brand Guidelines.- discrete
Logical indicating whether the desired scale should be discrete. The default is
TRUE. IfFALSE, a continuous scale with interpolated colours will be constructed, instead.- direction
Sets the order of colours in the scale. If 1, the default, colours are ordered from first to last as they appear in the palette. If -1, the order of colours is reversed.
- ...
Additional arguments passed to
ggplot2::discrete_scale()orggplot2::continuous_scale().
Value
A scale function that can be added to a ggplot2 plot.
See also
doe_palettes for the palettes available in
doestyle.
Examples
library(doestyle)
library(dplyr)
library(ggplot2)
public_schools |>
filter(grepl("Connected Communities", Principal_network)) |>
ggplot(aes(x = Principal_network, fill = Level_of_schooling)) +
geom_bar(colour = "black", position = position_dodge(preserve = "single")) +
theme(legend.position = "bottom") +
labs(y = "Schools") +
# Add a default department scale to the `fill` aesthetic.
scale_fill_doe()