Skip to contents

The scwplot package provides functions for applying consistent SCW-branded aesthetics to ggplot visualisations in R, as well as additional functionality that produces clean plots and makes plotting in R easier.


scwplot is not available on CRAN. In order to install the package, you must do so directly from this GitHub repository with {devtools}, using the code below:

# install.packages("pak")

If you haven’t already installed devtools, you will also have to run the first line of code in the code chunk.


The primary purpose of scwplot is to extend the functionality of ggplot to create consistent SCW-style figures, so usage builds on top of basic ggplot2 functionality.

A simple example of the scwplot usage:


ggplot(mpg, aes(displ, hwy, fill = as.factor(cyl))) +
    shape = 21, size = 6, stroke = 1,
    alpha = .8, width = .5, height = 2.5
    ) +
  labs(title = "Example {scwplot} Usage with MPG Dataset",
       subtitle = glue::glue("Plotting the Effect of Engine Displacement on ",
                             "Highway Miles Per Gallon, Split by Cylinders"),
       caption = "Source: EPA (",
       x = "Engine Displacement (in Litres)", y = "Miles per Gallon") +
  scale_fill_qualitative(palette = "scw") +

The package includes the following functionality:

  • Themes - functions for controlling the display of plot theme elements.
  • Colour - functions for incorporating the use of colour to display data.
  • Images - functions for adding images (i.e., brand images and logos) to plots.
  • Format - functions for applying final formatting to a plot and saving it to file.


This package takes a lot of inspiration from the NHS-R community’s NHSRtheme package and BBC’s bbplot package. The code, the structure of the repository, and the approach taken to achieve the package’s goals has been influenced by ggplot2 and ggsci.