Lee Bunce, Office of the Chief Statistician
Alice Byers, Data Innovation Team
11 April 2024
Explain why we created sgplot
Introduce sgplot and available colour palettes
Demonstrate how to use sgplot
sgplot contributes to the wider priorities of the Statistics group:
Accessibility
Quality, consistency and trust
RAP and use of open-source software
Story-driven publications
Palettes available for:
Categorical data (main
and main-extended
)
Sequential categorical data (sequential
)
Focus charts (focus
)
main
palette used by default
Analysis Function colour palettes also available in sgplot
main
, sequential
and focus
)Scottish Government palettes used by default, but easy to switch to analysis function (or other) palettes
The package can be developed to add other colour palettes where necessary; for example, if another organisation/agency has a palette based on their own brand colours.
On SCOTS, install in the same way you install other R packages
Easiest way is to use pkginstaller add-in
More guidance available on eRDM
Use remotes::install_github()
if not working on SCOTS
# A tibble: 6 × 3
year country lifeExp
<int> <fct> <dbl>
1 1952 China 44
2 1957 China 50.5
3 1962 China 44.5
4 1967 China 58.4
5 1972 China 63.1
6 1977 China 64.0
https://scotgovanalysis.github.io/sgplot
Cookbook; lots of example code
Reference; help files for sgplot functions
Further guidance on accessibility, colours and saving charts
Guidance on how to ask for help or contribute
Open an issue on GitHub if you’ve found a bug
Lee Bunce, Office of the Chief Statistician (OCS)
Alice Byers, Data Innovation Team