From b6e6e3903bee1c2661edc9d65ed35b422856546a Mon Sep 17 00:00:00 2001 From: alice-hannah Date: Tue, 20 May 2025 15:46:17 +0100 Subject: [PATCH 01/17] Add CRAN comments file --- .Rbuildignore | 1 + cran-comments.md | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 cran-comments.md diff --git a/.Rbuildignore b/.Rbuildignore index a2bc7d4..2ee9893 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -10,3 +10,4 @@ ^pkgdown$ ^doc$ ^Meta$ +^cran-comments\.md$ diff --git a/cran-comments.md b/cran-comments.md new file mode 100644 index 0000000..858617d --- /dev/null +++ b/cran-comments.md @@ -0,0 +1,5 @@ +## R CMD check results + +0 errors | 0 warnings | 1 note + +* This is a new release. From 816f024a12ccb57ccf654f455acf8445ab0a2595 Mon Sep 17 00:00:00 2001 From: alice-hannah Date: Tue, 20 May 2025 15:54:34 +0100 Subject: [PATCH 02/17] Add instruction to install from CRAN --- README.Rmd | 17 +++++++---------- README.md | 29 +++++++++-------------------- 2 files changed, 16 insertions(+), 30 deletions(-) diff --git a/README.Rmd b/README.Rmd index 768a3a5..55fe973 100644 --- a/README.Rmd +++ b/README.Rmd @@ -44,23 +44,20 @@ Slides are also available for an internal [presentation given to statisticians a ## Installation -If you are working within the Scottish Government network, you can install sgplot in the same way as with other R packages. The easiest way to do this is by using the [pkginstaller](https://github.com/ScotGovAnalysis/pkginstaller/tree/main) add-in. Further guidance is available on [eRDM](https://erdm.scotland.gov.uk:8443/documents/A42404229/details). +If you are working within the Scottish Government network, you can install sgplot in the same way as with other R packages. [Further guidance is available on eRDM](https://erdm.scotland.gov.uk:8443/documents/A42404229/details). -Alternatively, sgplot can be installed directly from GitHub. Note that this method requires the remotes package and may not work from within the Scottish Government network. +Alternatively, install from CRAN: ``` r -remotes::install_github( - "ScotGovAnalysis/sgplot", - upgrade = "never", - build_vignettes = TRUE -) +install.packages("sgplot") ``` -Finally, sgplot can also be installed by downloading the [zip of the repository](https://github.com/ScotGovAnalysis/sgplot/archive/main.zip) and running the following code, replacing the section marked `<>` (including the arrows themselves) with the location of the downloaded zip: +Or install the development version from GitHub: ``` r -remotes::install_local( - "/sgplot-main.zip", +# install.packages("remotes") +remotes::install_github( + "ScotGovAnalysis/sgplot", upgrade = "never", build_vignettes = TRUE ) diff --git a/README.md b/README.md index 8fa6bd8..57ff404 100644 --- a/README.md +++ b/README.md @@ -34,33 +34,22 @@ analysts](https://alice-hannah.github.io/presentations-and-blogs/2023-06-19_sgpl ## Installation If you are working within the Scottish Government network, you can -install sgplot in the same way as with other R packages. The easiest way -to do this is by using the -[pkginstaller](https://github.com/ScotGovAnalysis/pkginstaller/tree/main) -add-in. Further guidance is available on -[eRDM](https://erdm.scotland.gov.uk:8443/documents/A42404229/details). +install sgplot in the same way as with other R packages. [Further +guidance is available on +eRDM](https://erdm.scotland.gov.uk:8443/documents/A42404229/details). -Alternatively, sgplot can be installed directly from GitHub. Note that -this method requires the remotes package and may not work from within -the Scottish Government network. +Alternatively, install from CRAN: ``` r -remotes::install_github( - "ScotGovAnalysis/sgplot", - upgrade = "never", - build_vignettes = TRUE -) +install.packages("sgplot") ``` -Finally, sgplot can also be installed by downloading the [zip of the -repository](https://github.com/ScotGovAnalysis/sgplot/archive/main.zip) -and running the following code, replacing the section marked `<>` -(including the arrows themselves) with the location of the downloaded -zip: +Or install the development version from GitHub: ``` r -remotes::install_local( - "/sgplot-main.zip", +# install.packages("remotes") +remotes::install_github( + "ScotGovAnalysis/sgplot", upgrade = "never", build_vignettes = TRUE ) From d54e5a940dab656837308ed7e43ec52e13a87049 Mon Sep 17 00:00:00 2001 From: alice-hannah Date: Tue, 20 May 2025 15:07:06 +0000 Subject: [PATCH 03/17] Re-build README.md --- man/figures/README-ex1-1.svg | 1000 +++++++++++++++++----------------- man/figures/README-ex2-1.svg | 896 +++++++++++++++--------------- 2 files changed, 934 insertions(+), 962 deletions(-) diff --git a/man/figures/README-ex1-1.svg b/man/figures/README-ex1-1.svg index c0d844f..715c317 100644 --- a/man/figures/README-ex1-1.svg +++ b/man/figures/README-ex1-1.svg @@ -1,534 +1,520 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/man/figures/README-ex2-1.svg b/man/figures/README-ex2-1.svg index 0f77f28..4ccedb3 100644 --- a/man/figures/README-ex2-1.svg +++ b/man/figures/README-ex2-1.svg @@ -1,472 +1,458 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 246a5b032a5b5a7d741dd60f9f0700113ff4b6bc Mon Sep 17 00:00:00 2001 From: alice-hannah Date: Wed, 21 May 2025 16:28:01 +0100 Subject: [PATCH 04/17] Add missing @returns values --- R/scale_continuous_sg.R | 2 ++ R/scale_discrete_sg.R | 2 ++ R/theme_sg.R | 2 ++ R/use_sgplot.R | 3 +++ man/scale_colour_continuous_sg.Rd | 3 +++ man/scale_colour_discrete_sg.Rd | 3 +++ man/theme_sg.Rd | 3 +++ man/use_sgplot.Rd | 4 ++++ 8 files changed, 22 insertions(+) diff --git a/R/scale_continuous_sg.R b/R/scale_continuous_sg.R index 0b37868..59a3fb2 100644 --- a/R/scale_continuous_sg.R +++ b/R/scale_continuous_sg.R @@ -6,6 +6,8 @@ #' @param guide A name or function used to create guide. Default is "colourbar". #' @inheritParams scale_colour_discrete_sg #' +#' @returns ggplot2 continuous colour/fill scale +#' #' @examples #' library(ggplot2) #' diff --git a/R/scale_discrete_sg.R b/R/scale_discrete_sg.R index 9155885..7019098 100644 --- a/R/scale_discrete_sg.R +++ b/R/scale_discrete_sg.R @@ -8,6 +8,8 @@ #' reversed. #' @param ... Additional arguments passed to scale type. #' +#' @returns ggplot2 discrete colour/fill scale +#' #' @examples #' library(ggplot2) #' library(dplyr) diff --git a/R/theme_sg.R b/R/theme_sg.R index 1f54da9..07e53d2 100644 --- a/R/theme_sg.R +++ b/R/theme_sg.R @@ -11,6 +11,8 @@ #' @param legend 'right', 'left', 'top', 'bottom', or 'none' to determine the #' position of the legend. Defaults to 'right'. #' +#' @returns ggplot2 theme +#' #' @examples #' library(ggplot2) #' diff --git a/R/use_sgplot.R b/R/use_sgplot.R index 93939a6..82552c7 100644 --- a/R/use_sgplot.R +++ b/R/use_sgplot.R @@ -9,6 +9,9 @@ #' @param default_colour `r lifecycle::badge("deprecated")` Use the #' `palette_type` argument instead. #' +#' @returns NULL. Function is used for side effects of setting default ggplot2 +#' theme, colour palette and geom aesthetics. +#' #' @examples #' library(ggplot2) #' diff --git a/man/scale_colour_continuous_sg.Rd b/man/scale_colour_continuous_sg.Rd index 74eda3d..f1d0a34 100644 --- a/man/scale_colour_continuous_sg.Rd +++ b/man/scale_colour_continuous_sg.Rd @@ -39,6 +39,9 @@ reversed.} \item{...}{Additional arguments passed to scale type.} } +\value{ +ggplot2 continuous colour/fill scale +} \description{ Continuous colour/fill scales for Scottish Government plots } diff --git a/man/scale_colour_discrete_sg.Rd b/man/scale_colour_discrete_sg.Rd index 6b5252b..c0d7651 100644 --- a/man/scale_colour_discrete_sg.Rd +++ b/man/scale_colour_discrete_sg.Rd @@ -31,6 +31,9 @@ reversed.} \item{...}{Additional arguments passed to scale type.} } +\value{ +ggplot2 discrete colour/fill scale +} \description{ Discrete colour/fill scales for Scottish Government plots } diff --git a/man/theme_sg.Rd b/man/theme_sg.Rd index 80334e3..e93da97 100644 --- a/man/theme_sg.Rd +++ b/man/theme_sg.Rd @@ -28,6 +28,9 @@ ticks to 'xy'.} \item{legend}{'right', 'left', 'top', 'bottom', or 'none' to determine the position of the legend. Defaults to 'right'.} } +\value{ +ggplot2 theme +} \description{ ggplot2 theme for Scottish Government plots. } diff --git a/man/use_sgplot.Rd b/man/use_sgplot.Rd index ad300c0..dbd8ed0 100644 --- a/man/use_sgplot.Rd +++ b/man/use_sgplot.Rd @@ -15,6 +15,10 @@ available palette types, run \code{available_palette_types()}.} \item{default_colour}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use the \code{palette_type} argument instead.} } +\value{ +NULL. Function is used for side effects of setting default ggplot2 +theme, colour palette and geom aesthetics. +} \description{ Set sgplot theme, colour palette and geom aesthetic defaults for ggplot2 charts. From 55b9b53b340a8a720c0ad5b01e967a36640efb62 Mon Sep 17 00:00:00 2001 From: alice-hannah Date: Wed, 21 May 2025 16:29:56 +0100 Subject: [PATCH 05/17] Update year in licenses --- LICENSE | 2 +- LICENSE.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index e2771ba..2a0accb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,2 +1,2 @@ -YEAR: 2023 +YEAR: 2025 COPYRIGHT HOLDER: Crown Copyright (Scottish Government) diff --git a/LICENSE.md b/LICENSE.md index db58be4..49c760f 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ # MIT License -Copyright (c) 2023 Crown Copyright (Scottish Government) +Copyright (c) 2025 Crown Copyright (Scottish Government) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 6876e446854e1858de7cbbd253db266dbab6843b Mon Sep 17 00:00:00 2001 From: alice-hannah Date: Wed, 21 May 2025 16:52:22 +0100 Subject: [PATCH 06/17] Match case used in URL in DESCRIPTION --- _pkgdown.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_pkgdown.yml b/_pkgdown.yml index 5f46fcb..1cc32ff 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,4 +1,4 @@ -url: https://scotgovanalysis.github.io/sgplot +url: https://ScotGovAnalysis.github.io/sgplot template: bootstrap: 5 From 4b288d7054deab13d8fc872a02282b28f8eb2dce Mon Sep 17 00:00:00 2001 From: alice-hannah Date: Wed, 21 May 2025 17:02:54 +0100 Subject: [PATCH 07/17] Change http to https --- README.Rmd | 4 ++-- README.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.Rmd b/README.Rmd index 55fe973..4767bc4 100644 --- a/README.Rmd +++ b/README.Rmd @@ -132,5 +132,5 @@ Titles, subtitles and captions have been embedded in these example charts for de Unless stated otherwise, the codebase is released under [the MIT License](LICENSE). This covers both the codebase and any sample code in the documentation. -The documentation is [© Crown copyright](http://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/) and available under the terms -of the [Open Government 3.0](http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) licence. +The documentation is [© Crown copyright](https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/) and available under the terms +of the [Open Government 3.0](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) licence. diff --git a/README.md b/README.md index 57ff404..938514f 100644 --- a/README.md +++ b/README.md @@ -140,7 +140,7 @@ License](LICENSE). This covers both the codebase and any sample code in the documentation. The documentation is [© Crown -copyright](http://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/) +copyright](https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/) and available under the terms of the [Open Government -3.0](http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) +3.0](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) licence. From 64b9d0a27cb4b1124470460fc2a4f84b2fa91c11 Mon Sep 17 00:00:00 2001 From: alice-hannah Date: Wed, 21 May 2025 17:20:03 +0100 Subject: [PATCH 08/17] Update package description --- DESCRIPTION | 4 ++-- man/sgplot-package.Rd | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index a31bd82..ac88852 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -5,8 +5,8 @@ Authors@R: c( person("Scottish Government", , , "statistics.enquiries@gov.scot", role = c("cph", "fnd")), person("Alice", "Hannah", , "alice.hannah@gov.scot", role = c("aut", "cre")) ) -Description: Standard ggplot theme and colour palettes for use in Scottish - Government. +Description: A 'ggplot2' theme and colour palettes to create accessible + data visualisations in the Scottish Government. License: MIT + file LICENSE URL: https://github.com/ScotGovAnalysis/sgplot, https://ScotGovAnalysis.github.io/sgplot diff --git a/man/sgplot-package.Rd b/man/sgplot-package.Rd index bd5d3c7..49691ba 100644 --- a/man/sgplot-package.Rd +++ b/man/sgplot-package.Rd @@ -6,7 +6,7 @@ \alias{sgplot-package} \title{sgplot: Graphic Styles and Colours for Scottish Government Plots} \description{ -Standard ggplot theme and colour palettes for use in Scottish Government. +A 'ggplot2' theme and colour palettes to create accessible data visualisations in the Scottish Government. } \seealso{ Useful links: From c5cd9699f1caab51408dc850ff2c4295f4349a58 Mon Sep 17 00:00:00 2001 From: alice-hannah Date: Thu, 22 May 2025 10:29:13 +0100 Subject: [PATCH 09/17] Use dplyr pipe instead of base pipe. --- R/colour_table.R | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/R/colour_table.R b/R/colour_table.R index 81eeb93..d36a6a0 100644 --- a/R/colour_table.R +++ b/R/colour_table.R @@ -9,14 +9,16 @@ colour_table <- function(pal) { - tibble::enframe(pal) |> - dplyr::mutate(example = "") |> + `%>%` <- dplyr::`%>%` + + tibble::enframe(pal) %>% + dplyr::mutate(example = "") %>% dplyr::mutate(value = factor( pal, ordered = TRUE, levels = unname(pal) - )) |> - gt::gt() |> + )) %>% + gt::gt() %>% gt::data_color( columns = .data$value, target_columns = .data$example, @@ -24,16 +26,16 @@ colour_table <- function(pal) { palette = pal, domain = NULL ) - ) |> + ) %>% gt::cols_width( name ~ gt::px(110), value ~ gt::px(100), example ~ gt::px(150) - ) |> + ) %>% gt::cols_align( align = "left", columns = dplyr::everything() - ) |> + ) %>% gt::cols_label( name = "Colour name", value = "Hex code", From 3866e317cbcebc80b969547d43ef8623b0c442e5 Mon Sep 17 00:00:00 2001 From: alice-hannah Date: Thu, 22 May 2025 10:32:55 +0100 Subject: [PATCH 10/17] Tidy up news --- NEWS.md | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/NEWS.md b/NEWS.md index 386b6da..440411b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,48 +1,47 @@ # sgplot (development version) -* New functionality to set default colour palettes in `use_sgplot()` (#34). -Previously, users were only able to control the default colour in charts -with a single colour (by providing a `default_colour`) and not for charts -where `colour` or `fill` aesthetics were used. Now, the `palette_type` argument -can be used to set the default palette type. For example, Social Security -Scotland users can use `use_sgplot(palette_type = "sss")`. The "sg" palettes -are used by default. +* `use_sgplot()` gains a `palette_type` argument to set default palette type +for geoms. The default value is "sg" to use Scottish Government colour palettes. +To use the Social Security Scotland palette type, for example, use: +`use_sgplot(palette_type = "sss")` (#34). -* The `default_colour` argument of `use_sgplot()` has been deprecated in favour -of the `palette_type` argument (#34). +* The `default_colour` argument of `use_sgplot()` is deprecated in favour of the +`palette_type` argument (#34). # sgplot 0.3.0 -* Add Social Security Scotland colours (`sss_colour_values`) and palettes (`sss_colour_palettes`) +* Add Social Security Scotland colours (`sss_colour_values`) and palettes +(`sss_colour_palettes`). -* Fix bug in `use_sgplot()` when passing arguments to `theme_sg()` +* Fix bug in `use_sgplot()` when passing arguments to `theme_sg()`. # sgplot 0.2.2 -* Fix links to contributing guidance in vignettes +* Fix links to contributing guidance in vignettes. -* Update required `roxygen` version +* Update required `roxygen` version. # sgplot 0.2.1 -* Fix issue where `scale_` functions didn't work without the package being loaded (#26) +* Fix issue where `scale_` functions didn't work without the package being +loaded (#26). -* Add [examples of using non-default colour palettes](https://ScotGovAnalysis.github.io/sgplot/articles/cookbook.html#using-different-colour-palettes) (#24) +* Add [examples of using non-default colour palettes](https://ScotGovAnalysis.github.io/sgplot/articles/cookbook.html#using-different-colour-palettes) (#24). -* Add link to `theme_sg()` in `use_sgplot()` help file +* Add link to `theme_sg()` in `use_sgplot()` help file. # sgplot 0.2.0 -* Add [Scottish Government Design System colour palettes](https://designsystem.gov.scot/guidance/charts/data-visualisation-colour-palettes) +* Add [Scottish Government Design System colour palettes](https://designsystem.gov.scot/guidance/charts/data-visualisation-colour-palettes). -* Reduce `base_line_size` in `theme_sg()` +* Reduce `base_line_size` in `theme_sg()`. * Remove default dark blue outline from `geom_col` and `geom_bar` when using `use_sgplot()`. # sgplot 0.1.0 -* First package release +* First package release. -* Add functions to create accessible plots using `ggplot2` +* Add functions to create accessible plots using `ggplot2`. -* Add pkgdown site (https://ScotGovAnalysis.github.io/sgplot) including [cookbook](https://ScotGovAnalysis.github.io/sgplot/articles/cookbook.html) +* Add pkgdown site (https://ScotGovAnalysis.github.io/sgplot) including [cookbook](https://ScotGovAnalysis.github.io/sgplot/articles/cookbook.html). From b19403b994bae0b4a48af95a1c776c32f8bd1dd0 Mon Sep 17 00:00:00 2001 From: alice-hannah Date: Thu, 22 May 2025 10:38:17 +0100 Subject: [PATCH 11/17] Re-render README.Rmd --- man/figures/README-ex1-1.svg | 538 +++++++++++++++++------------------ man/figures/README-ex2-1.svg | 498 ++++++++++++++++---------------- 2 files changed, 518 insertions(+), 518 deletions(-) diff --git a/man/figures/README-ex1-1.svg b/man/figures/README-ex1-1.svg index 715c317..fef9b91 100644 --- a/man/figures/README-ex1-1.svg +++ b/man/figures/README-ex1-1.svg @@ -3,518 +3,518 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/man/figures/README-ex2-1.svg b/man/figures/README-ex2-1.svg index 4ccedb3..d1335d3 100644 --- a/man/figures/README-ex2-1.svg +++ b/man/figures/README-ex2-1.svg @@ -3,456 +3,456 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + From d6be6870862e8c32c006d0c412b4325e116ddbc7 Mon Sep 17 00:00:00 2001 From: alice-hannah Date: Thu, 22 May 2025 09:39:52 +0000 Subject: [PATCH 12/17] Re-build README.md --- man/figures/README-ex1-1.svg | 538 +++++++++++++++++------------------ man/figures/README-ex2-1.svg | 498 ++++++++++++++++---------------- 2 files changed, 518 insertions(+), 518 deletions(-) diff --git a/man/figures/README-ex1-1.svg b/man/figures/README-ex1-1.svg index fef9b91..715c317 100644 --- a/man/figures/README-ex1-1.svg +++ b/man/figures/README-ex1-1.svg @@ -3,518 +3,518 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/man/figures/README-ex2-1.svg b/man/figures/README-ex2-1.svg index d1335d3..4ccedb3 100644 --- a/man/figures/README-ex2-1.svg +++ b/man/figures/README-ex2-1.svg @@ -3,456 +3,456 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + From 60d9a1e1a55a37c32e4a2a131c8fe2888fc58e9c Mon Sep 17 00:00:00 2001 From: alice-hannah Date: Thu, 22 May 2025 10:48:33 +0100 Subject: [PATCH 13/17] Fix spelling error --- vignettes/colours.Rmd | 2 +- vignettes/cookbook/_colour-palettes.Rmd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vignettes/colours.Rmd b/vignettes/colours.Rmd index 1df2b6f..7e22a29 100644 --- a/vignettes/colours.Rmd +++ b/vignettes/colours.Rmd @@ -222,7 +222,7 @@ The [Scottish Government focus palette](#focus-chart-palette) does not have this There may be instances where you'd like to use a different colour palette. If so, this should be carefully considered to ensure it meets accessibility requirements. -The Analysis Function guidance outlines [appropriate steps for choosing your own accessibile colour palette](https://analysisfunction.civilservice.gov.uk/policy-store/data-visualisation-colours-in-charts/#section-9) and should be used. +The Analysis Function guidance outlines [appropriate steps for choosing your own accessible colour palette](https://analysisfunction.civilservice.gov.uk/policy-store/data-visualisation-colours-in-charts/#section-9) and should be used. An example of how to use an alternative colour palette is provided in the [cookbook](https://scotgovanalysis.github.io/sgplot/articles/cookbook.html#using-your-own-colour-palette). However, if you use a different palette regularly and feel it would be useful for this to be added to sgplot, please make a suggestion as per the [contributing guidance](https://scotgovanalysis.github.io/sgplot/CONTRIBUTING.html). diff --git a/vignettes/cookbook/_colour-palettes.Rmd b/vignettes/cookbook/_colour-palettes.Rmd index 29ba928..6f81c52 100644 --- a/vignettes/cookbook/_colour-palettes.Rmd +++ b/vignettes/cookbook/_colour-palettes.Rmd @@ -74,7 +74,7 @@ gapminder |> There may be instances where you'd like to use a colour palette that is not available in sgplot. If so, this should be carefully considered to ensure it meets accessibility requirements. -The Analysis Function guidance outlines [appropriate steps for choosing your own accessibile colour palette](https://analysisfunction.civilservice.gov.uk/policy-store/data-visualisation-colours-in-charts/#section-9) and should be used. +The Analysis Function guidance outlines [appropriate steps for choosing your own accessible colour palette](https://analysisfunction.civilservice.gov.uk/policy-store/data-visualisation-colours-in-charts/#section-9) and should be used. ```{r different-colour-palette-1} #| fig.alt = "A line chart using sgplot theme and first colour from custom palette." From 47f9cb53379c9dd73367791db49ebbdbfab28766 Mon Sep 17 00:00:00 2001 From: alice-hannah Date: Thu, 22 May 2025 11:23:56 +0100 Subject: [PATCH 14/17] Tidy up URLs --- DESCRIPTION | 4 ++-- README.Rmd | 6 +++--- man/sgplot-package.Rd | 4 ++-- vignettes/accessibility.Rmd | 4 ++-- vignettes/cookbook/_chart-types.Rmd | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index ac88852..38776ae 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -8,8 +8,8 @@ Authors@R: c( Description: A 'ggplot2' theme and colour palettes to create accessible data visualisations in the Scottish Government. License: MIT + file LICENSE -URL: https://github.com/ScotGovAnalysis/sgplot, - https://ScotGovAnalysis.github.io/sgplot +URL: https://github.com/ScotGovAnalysis/sgplot/, + https://ScotGovAnalysis.github.io/sgplot/ BugReports: https://github.com/ScotGovAnalysis/sgplot/issues Depends: R (>= 2.10) diff --git a/README.Rmd b/README.Rmd index 4767bc4..2157ff0 100644 --- a/README.Rmd +++ b/README.Rmd @@ -37,14 +37,14 @@ sgplot is an R package for creating accessible plots in the Scottish Government. The package has been developed using the [Government Analysis Function Data Visualisation guidance](https://analysisfunction.civilservice.gov.uk/policy-store/data-visualisation-charts/) and uses accessible colour palettes from the [Scottish Government Design System](https://designsystem.gov.scot/guidance/charts/data-visualisation-colour-palettes). sgplot should be used in conjunction with these guidance documents. -More information about the package and its functions can be found on the [sgplot website](https://ScotGovAnalysis.github.io/sgplot). +More information about the package and its functions can be found on the [sgplot website](https://ScotGovAnalysis.github.io/sgplot/). In particular, the [cookbook](https://ScotGovAnalysis.github.io/sgplot/articles/cookbook.html) contains lots of examples. Slides are also available for an internal [presentation given to statisticians and analysts](https://alice-hannah.github.io/presentations-and-blogs/2023-06-19_sgplot/slides.html). ## Installation -If you are working within the Scottish Government network, you can install sgplot in the same way as with other R packages. [Further guidance is available on eRDM](https://erdm.scotland.gov.uk:8443/documents/A42404229/details). +If you are working within the Scottish Government network, you can install sgplot in the same way as with other R packages. Alternatively, install from CRAN: @@ -72,7 +72,7 @@ Once installed, sgplot can be loaded using the `library()` function: library(sgplot) ``` -Help files for each function in the package can be found on the [References](https://ScotGovAnalysis.github.io/sgplot/reference) page of the package website. Alternatively, type `?function_name` into the RStudio console. For example: +Help files for each function in the package can be found on the [References](https://ScotGovAnalysis.github.io/sgplot/reference/) page of the package website. Alternatively, type `?function_name` into the RStudio console. For example: ``` r ?theme_sg() diff --git a/man/sgplot-package.Rd b/man/sgplot-package.Rd index 49691ba..bfd8583 100644 --- a/man/sgplot-package.Rd +++ b/man/sgplot-package.Rd @@ -11,8 +11,8 @@ A 'ggplot2' theme and colour palettes to create accessible data visualisations i \seealso{ Useful links: \itemize{ - \item \url{https://github.com/ScotGovAnalysis/sgplot} - \item \url{https://ScotGovAnalysis.github.io/sgplot} + \item \url{https://github.com/ScotGovAnalysis/sgplot/} + \item \url{https://ScotGovAnalysis.github.io/sgplot/} \item Report bugs at \url{https://github.com/ScotGovAnalysis/sgplot/issues} } diff --git a/vignettes/accessibility.Rmd b/vignettes/accessibility.Rmd index 4985cc0..709f184 100644 --- a/vignettes/accessibility.Rmd +++ b/vignettes/accessibility.Rmd @@ -62,7 +62,7 @@ More information on sgplot colours can be found at `vignette("colours")`. ## Other accessibility considerations -Using sgplot does not guarantee accessibility. The Analysis Function [chart guidance](https://analysisfunction.civilservice.gov.uk/policy-store/data-visualisation-charts) contains detailed information on other considerations that should be made. +Using sgplot does not guarantee accessibility. The Analysis Function [chart guidance](https://analysisfunction.civilservice.gov.uk/policy-store/data-visualisation-charts/) contains detailed information on other considerations that should be made. Not all of these are repeated here, but we think the following are a good place to start: * Consider what type of chart is best to convey your message. Keep it as simple as possible. @@ -75,7 +75,7 @@ Not all of these are repeated here, but we think the following are a good place * If horizontal text is difficult to read (for example, if axis labels are overlapping), consider a different chart orientation or type. -* If using a bar chart, the gap between bars should be narrower than the width of a single bar. The [R Graphics cookbook](https://r-graphics.org/recipe-bar-graph-adjust-width) describes how to do this. +* If using a bar chart, the gap between bars should be narrower than the width of a single bar. The [R Graphics cookbook](https://r-graphics.org/RECIPE-BAR-GRAPH-ADJUST-WIDTH.html) describes how to do this. * Use commas as thousands separators in axis labels or text annotations. diff --git a/vignettes/cookbook/_chart-types.Rmd b/vignettes/cookbook/_chart-types.Rmd index a135d8e..e56e485 100644 --- a/vignettes/cookbook/_chart-types.Rmd +++ b/vignettes/cookbook/_chart-types.Rmd @@ -321,4 +321,4 @@ plotly::ggplotly(p, tooltip = "text") |> ) ``` -sgplot currently only works with `ggplot2` charts, however there are plans to [develop the package further to support interactive Highcharts](https://github.com/scotgovanalysis/sgplot/issues/5) produced using the [`highcharter`](https://jkunst.com/highcharter) package. +sgplot currently only works with `ggplot2` charts, however there are plans to [develop the package further to support interactive Highcharts](https://github.com/scotgovanalysis/sgplot/issues/5) produced using the [`highcharter`](https://jkunst.com/highcharter/) package. From d5c813f5369b6a430913296b91e8c4e0fec55ae6 Mon Sep 17 00:00:00 2001 From: alice-hannah Date: Thu, 22 May 2025 10:25:47 +0000 Subject: [PATCH 15/17] Re-build README.md --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 938514f..562d953 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ System](https://designsystem.gov.scot/guidance/charts/data-visualisation-colour- sgplot should be used in conjunction with these guidance documents. More information about the package and its functions can be found on the -[sgplot website](https://ScotGovAnalysis.github.io/sgplot). In +[sgplot website](https://ScotGovAnalysis.github.io/sgplot/). In particular, the [cookbook](https://ScotGovAnalysis.github.io/sgplot/articles/cookbook.html) contains lots of examples. Slides are also available for an internal @@ -34,9 +34,7 @@ analysts](https://alice-hannah.github.io/presentations-and-blogs/2023-06-19_sgpl ## Installation If you are working within the Scottish Government network, you can -install sgplot in the same way as with other R packages. [Further -guidance is available on -eRDM](https://erdm.scotland.gov.uk:8443/documents/A42404229/details). +install sgplot in the same way as with other R packages. Alternatively, install from CRAN: @@ -64,8 +62,8 @@ library(sgplot) ``` Help files for each function in the package can be found on the -[References](https://ScotGovAnalysis.github.io/sgplot/reference) page of -the package website. Alternatively, type `?function_name` into the +[References](https://ScotGovAnalysis.github.io/sgplot/reference/) page +of the package website. Alternatively, type `?function_name` into the RStudio console. For example: ``` r From 446d40f63a22295d16b71ed6698f3901aa89fb18 Mon Sep 17 00:00:00 2001 From: alice-hannah Date: Thu, 22 May 2025 11:45:14 +0100 Subject: [PATCH 16/17] Increment version number to 0.4.0 --- DESCRIPTION | 2 +- NEWS.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 38776ae..dd23be7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: sgplot Title: Graphic Styles and Colours for Scottish Government Plots -Version: 0.3.0.9000 +Version: 0.4.0 Authors@R: c( person("Scottish Government", , , "statistics.enquiries@gov.scot", role = c("cph", "fnd")), person("Alice", "Hannah", , "alice.hannah@gov.scot", role = c("aut", "cre")) diff --git a/NEWS.md b/NEWS.md index 440411b..48d4b30 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# sgplot (development version) +# sgplot 0.4.0 * `use_sgplot()` gains a `palette_type` argument to set default palette type for geoms. The default value is "sg" to use Scottish Government colour palettes. From ae6a6786ac9c5009d8b01c6ba0e42f7baa35b319 Mon Sep 17 00:00:00 2001 From: alice-hannah Date: Thu, 22 May 2025 11:45:54 +0100 Subject: [PATCH 17/17] Remove note --- cran-comments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cran-comments.md b/cran-comments.md index 858617d..c31fff6 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,5 +1,5 @@ ## R CMD check results -0 errors | 0 warnings | 1 note +0 errors | 0 warnings | 0 notes * This is a new release.