R/2_palettes.R
scale_fill_cs.Rd
Creates a discrete fill scale for ggplot2 using predefined CSIDS color palettes.
scale_fill_cs(..., palette = "primary", direction = 1)
Additional arguments passed to ggplot2::discrete_scale()
Name of color palette to use (default: "primary"). Options: "primary", "warning", "posneg"
Direction of color palette: 1 for normal, -1 for reversed (default: 1)
A ggplot2 discrete fill scale
Other csstyle_ggplot2: scale_color_cs(), theme_cs()
scale_color_cs()
theme_cs()
library(ggplot2) # Default primary fill scale ggplot(mtcars, aes(x = factor(cyl), fill = factor(cyl))) + geom_bar() + scale_fill_cs() # Use posneg palette ggplot(mtcars, aes(x = factor(vs), fill = factor(vs))) + geom_bar() + scale_fill_cs(palette = "posneg")