scsplot
is superseded by sgplot
.scsplot
contains functions for creating graphics in reporting of the Scottish Government Covid-19 Scottish Contact Survey (SCS).
The following functions are available:
scs_theme()
to apply a consistent theme to ggplot chartsscale_colour_discrete_scs()
to apply discrete colour scales for chartsscale_colour_continuouse_scs()
to apply continuous colour scales for chartsscale_fill_discrete_scs()
to apply discrete colour filling scales for chartsscale_fill_continuous_scs()
to apply continuous colour filling scales for chartsThe available colours have been selected using the Government Statistical Service (GSS) Data visualisation: colours guidance. Names and hex codes for available colours and palettes can be viewed by running the following code:
# View names and hex codes for all colours scs_colour_values # View names and hex codes for all colour palettes scs_colour_palettes # View names and hex codes for `main` colour palette scs_colour_palettes[["main"]]
The following colour palettes are available: main, sequential and focus.
To install scsplot
, the package remotes
is required. The package can be installed directly from GitHub with:
remotes::install_github( "DataScienceScotland/scsplot", upgrade = "never" )
Network security settings may prevent remotes::install_github()
from working. If this is the case, scsplot
can be installed by downloading the zip of the repository and running the following code (replacing the section marked <>
, including the arrows themselves):
remotes::install_local( "<FILEPATH OF ZIPPED FILE>/scsplot-main.zip", upgrade = "never" )
The scsplot
package can then be loaded using the library()
function:
library(scsplot)
To access the help file associated with a function within the scsplot
package, type ?function_name
into the RStudio console, for example:
?scs_theme
At present, this package is maintained by Alice Byers.
This package has primarily been developed for use by the Scottish Government Scottish Contact Survey team. However, its contents may be useful more widely. As such, suggestions and contributions are welcome.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.