| Title: | Strategy Unit Theme |
|---|---|
| Description: | This package provides ggplot2 themes and colour palettes for use by The Strategy Unit. |
| Authors: | Tom Jemmett [aut, cre] (ORCID: <https://orcid.org/0000-0002-6943-2990>), Stacey Croft [aut], The Strategy Unit [cph] |
| Maintainer: | Tom Jemmett <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.7 |
| Built: | 2026-05-12 05:31:05 UTC |
| Source: | https://github.com/The-Strategy-Unit/StrategyUnitTheme |
Format for converting from R Markdown to a Strategy Unit branded MS Word document.
su_document( use_numbered_headings = FALSE, toc = FALSE, toc_depth = 1, fig_caption = TRUE, df_print = "kable", highlight = "default", keep_md = FALSE, md_extensions = NULL, pandoc_args = NULL )su_document( use_numbered_headings = FALSE, toc = FALSE, toc_depth = 1, fig_caption = TRUE, df_print = "kable", highlight = "default", keep_md = FALSE, md_extensions = NULL, pandoc_args = NULL )
use_numbered_headings |
should we use numbered headings? Defaults to false |
toc |
|
toc_depth |
Depth of headers to include in table of contents |
fig_caption |
|
df_print |
Method to be used for printing data frames. Valid values
include "default", "kable", "tibble", and "paged". The "default" method
uses a corresponding S3 method of |
highlight |
Syntax highlighting style. Supported styles include
"default", "tango", "pygments", "kate", "monochrome", "espresso",
"zenburn", and "haddock". Pass |
keep_md |
Keep the markdown file generated by knitting. |
md_extensions |
Markdown extensions to be added or removed from the
default definition or R Markdown. See the |
pandoc_args |
Additional command line options to pass to pandoc |
See the online
documentation for additional details on using the word_document
format.
R Markdown output format to pass to render
## Not run: library(rmarkdown) # simple invocation render("input.Rmd", su_document()) ## End(Not run)## Not run: library(rmarkdown) # simple invocation render("input.Rmd", su_document()) ## End(Not run)
Format for converting from R Markdown to a Strategy Unit branded xaringan presentation.
su_presentation(...)su_presentation(...)
... |
additional arguments to pass to [xaringan::moon_reader()] |
R Markdown output format to pass to render
## Not run: library(rmarkdown) # simple invocation render("input.Rmd", su_presentation()) ## End(Not run)## Not run: library(rmarkdown) # simple invocation render("input.Rmd", su_presentation()) ## End(Not run)
Creates a base theme for ggplot objects. By default this uses a font that requires the extrafont package to be installed.
su_theme(base_family = "Segoe UI")su_theme(base_family = "Segoe UI")
base_family |
The font to use in this theme |
## Not run: library(ggplot2) library(StrategyUnitTheme) ggplot(iris, aes(Sepal.Width, Sepal.Length, colour = Species)) + geom_point() + su_theme() ## End(Not run)## Not run: library(ggplot2) library(StrategyUnitTheme) ggplot(iris, aes(Sepal.Width, Sepal.Length, colour = Species)) + geom_point() + su_theme() ## End(Not run)
This function returns the colours that are used in the Strategy Unit theme as a named vector of RGB values in hexadecimal form.
su_theme_cols( ..., palette = c(NA, "main", "oranges", "charcoals", "slates", "reds", "blues") )su_theme_cols( ..., palette = c(NA, "main", "oranges", "charcoals", "slates", "reds", "blues") )
... |
individual colours that you wish to get the values of |
palette |
a name of a palette to select the colours of |
If no arguments are passed to the function, then all of the colours are returned. If only specific colours are required, then the names of the colours that are required can be passed as strings to the function, and only those colours will be returned.
If a "pallete" is selected then no arguments should be passed to ...
Only one palete can be selected at a time.
a named vector of RGB colours in hexadecimal form
# show all of the colours su_theme_cols() # or, just show some colours su_theme_cols("orange", "red", "grey") # or, select a single palette su_theme_cols(palette = "slates")# show all of the colours su_theme_cols() # or, just show some colours su_theme_cols("orange", "red", "grey") # or, select a single palette su_theme_cols(palette = "slates")
Generates a two colour gradient (low-high)
scale_colour_su( palette = c("main", "oranges", "charcoals", "slates", "reds", "blues"), discrete = TRUE, reverse = FALSE, ... ) scale_color_su( palette = c("main", "oranges", "charcoals", "slates", "reds", "blues"), discrete = TRUE, reverse = FALSE, ... ) scale_fill_su( palette = c("main", "oranges", "charcoals", "slates", "reds", "blues"), discrete = TRUE, reverse = FALSE, ... )scale_colour_su( palette = c("main", "oranges", "charcoals", "slates", "reds", "blues"), discrete = TRUE, reverse = FALSE, ... ) scale_color_su( palette = c("main", "oranges", "charcoals", "slates", "reds", "blues"), discrete = TRUE, reverse = FALSE, ... ) scale_fill_su( palette = c("main", "oranges", "charcoals", "slates", "reds", "blues"), discrete = TRUE, reverse = FALSE, ... )
palette |
The name of palette to use |
discrete |
Optional: boolean to indicate that this scale is a discrete scale. Defaults to TRUE |
reverse |
Optional: boolean to reverse the direction of the scale. Defaults to FALSE |
... |
additional arguments passed to the ggplot functions |
a scale object to be used with a ggplot object
This function returns a palette generated by colorRampPalette from one of the Strategy Unit palettes
su_theme_pal( palette = c("main", "oranges", "charcoals", "slates", "reds", "blues"), reverse = FALSE, ... )su_theme_pal( palette = c("main", "oranges", "charcoals", "slates", "reds", "blues"), reverse = FALSE, ... )
palette |
The name of palette to use |
reverse |
Optional: boolean value to reverse the palette |
... |
arguments to pass to colorRamp |
A colorRamp function
su_theme_pal() # or, specify a paltte su_theme_pal("oranges") # a reverse palette su_theme_pal("slates", TRUE)su_theme_pal() # or, specify a paltte su_theme_pal("oranges") # a reverse palette su_theme_pal("slates", TRUE)