Add colour and fill scales to ggplot with DfE theme

scale_colour_dfe(palette = "main", discrete = TRUE, reverse = FALSE, ...)

scale_fill_dfe(palette = "main", discrete = TRUE, reverse = FALSE, ...)

Arguments

palette

The colour palette to use

discrete

Is the scale discrete (defaults TRUE)

reverse

Reverse the order of the scale (defaults FALSE)

...

arguments passed onto discrete_scale() or scale_fill_gradientn()

Value

These are the palettes in their current form

  • main - Blue red turquoise (discrete, 3 colours)

  • warm - Red to purple (continuous)

  • cool - Blue to lime (continuous)

  • full - all colours in the brand (discrete, 7 colours)

  • likert - red to blue, grey midpoint (diverging)

  • likert2 - green to purple, white midpoint (diverging)

  • likert3 - red to blue, white midpoint (diverging)

  • heat - white to red (continuous)

  • heat2 - white to pink (continuous)

  • cold - white to blue (continuous)

  • cold2 - white to turqouise (continuous)

Functions

  • scale_fill_dfe(): Add fill scale to ggplot with DfE theme

Examples

library(ggplot2)


ggplot(iris, aes(x = Sepal.Width, y = Sepal.Length, colour = Species)) +
  geom_point() +
  scale_colour_dfe()


ggplot(iris, aes(x = Petal.Length, y = Sepal.Length,colour = Sepal.Width)) +
  geom_point(size = 3, alpha = 3/4) +
  scale_colour_dfe(palette = "heat", discrete = FALSE)


ggplot(iris, aes(Species, Sepal.Length, fill = Species)) +
  geom_col() +
  scale_fill_dfe()


ggplot(faithfuld, aes(waiting, eruptions, fill = density)) +
  geom_tile() +
  scale_fill_dfe(discrete = FALSE, palette = "heat")