diff --git a/.github/SUPPORT.md b/.github/SUPPORT.md index 87bb34a..25ec113 100644 --- a/.github/SUPPORT.md +++ b/.github/SUPPORT.md @@ -2,6 +2,17 @@ Thanks for using sgplot! +## Try these first + +* If you want to find out more about any of sgplot's functions; help files can be found on the [References](https://datasciencescotland.github.io/sgplot/reference) page of the package website. Alternatively, type `?function_name` into the RStudio console. For example: + + ``` r + ?theme_sg() + ``` + +* If you need help with `ggplot2`, it might be helpful to look at the [sgplot cookbook](https://datasciencescotland.github.io/sgplot/articles/cookbook.html) which contains lots of example code to create various types of chart. The [ggplot2 website](https://ggplot2.tidyverse.org/index.html) may also be helpful. + + ## Where to ask for help * If it's a question: Ask the Scottish Government [R Yammer community](https://web.yammer.com/main/groups/eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiI2MzQ4MzE2NjczIn0). diff --git a/.github/workflows/render-readme.yaml b/.github/workflows/render-readme.yaml new file mode 100644 index 0000000..b203a08 --- /dev/null +++ b/.github/workflows/render-readme.yaml @@ -0,0 +1,35 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: push + +name: render-readme + +jobs: + render-readme: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Checkout repo + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rmarkdown, local::. + + - name: Render README + run: Rscript -e 'rmarkdown::render("README.Rmd")' + + - name: Commit rendered README + run: | + git config --local user.name "$GITHUB_ACTOR" + git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" + git add README.md man/figures/README-* + git commit -m "Re-build README.md" || echo "No changes to commit" + git push origin || echo "No changes to commit" diff --git a/DESCRIPTION b/DESCRIPTION index 5b9dfcf..7c49cfb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: sgplot Title: Graphic Styles and Colours for Scottish Government Plots -Version: 0.0.0.9001 +Version: 0.1.0 Authors@R: c( person("Scottish Government", , , "statistics.enquiries@gov.scot", role = c("cph", "fnd")), person("Alice", "Byers", , "alice.byers@gov.scot", c("aut", "cre")) diff --git a/NEWS.md b/NEWS.md index 4d9fd31..1d43d76 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,13 +1,5 @@ -## sgplot 0.0.0.9001 +# sgplot 0.1.0 -* Developments to `theme_sg()` following testing feedback -* Add [cookbook](https://datasciencescotland.github.io/sgplot/articles/cookbook.html) to pkgdown site -* Add [saving charts](https://datasciencescotland.github.io/sgplot/articles/saving.html) article to pkgdown site -* Add `mm_to_inch()` helper function -* Remove use of showtext package for Google font - -## sgplot 0.0.0.9000 - -* First development version for testing +* First package release * Add functions to create accessible plots using `ggplot2` -* Add pkgdown site (https://datasciencescotland.github.io/sgplot) +* Add pkgdown site (https://datasciencescotland.github.io/sgplot) including [cookbook](https://datasciencescotland.github.io/sgplot/articles/cookbook.html) diff --git a/README.Rmd b/README.Rmd index fe4a77d..abcb627 100644 --- a/README.Rmd +++ b/README.Rmd @@ -41,7 +41,9 @@ More information about the package and its functions can be found on the [sgplot ## Installation -To install sgplot, the remotes package is required. The package can then be installed directly from GitHub with: +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/DataScienceScotland/pkginstaller/tree/main) add-in. 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. ``` r remotes::install_github( @@ -51,7 +53,7 @@ remotes::install_github( ) ``` -Network security settings may prevent `remotes::install_github()` from working. If this is the case, sgplot can be installed by downloading the [zip of the repository](https://github.com/DataScienceScotland/sgplot/archive/main.zip) and running the following code, replacing the section marked `<>` (including the arrows themselves) with the location of the downloaded zip: +Finally, sgplot can also be installed by downloading the [zip of the repository](https://github.com/DataScienceScotland/sgplot/archive/main.zip) and running the following code, replacing the section marked `<>` (including the arrows themselves) with the location of the downloaded zip: ``` r remotes::install_local( diff --git a/README.md b/README.md index 3b1f66f..29b7c6a 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,16 @@ contains lots of examples. ## Installation -To install sgplot, the remotes package is required. The package can then -be installed directly from GitHub with: +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/DataScienceScotland/pkginstaller/tree/main) +add-in. 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. ``` r remotes::install_github( @@ -43,9 +51,7 @@ remotes::install_github( ) ``` -Network security settings may prevent `remotes::install_github()` from -working. If this is the case, sgplot can be installed by downloading the -[zip of the +Finally, sgplot can also be installed by downloading the [zip of the repository](https://github.com/DataScienceScotland/sgplot/archive/main.zip) and running the following code, replacing the section marked `<>` (including the arrows themselves) with the location of the downloaded diff --git a/man/figures/README-ex1-1.svg b/man/figures/README-ex1-1.svg index cd2b694..c0d844f 100644 --- a/man/figures/README-ex1-1.svg +++ b/man/figures/README-ex1-1.svg @@ -3,532 +3,532 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/man/figures/README-ex2-1.svg b/man/figures/README-ex2-1.svg index 0167a54..d3708e3 100644 --- a/man/figures/README-ex2-1.svg +++ b/man/figures/README-ex2-1.svg @@ -3,500 +3,500 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + - - + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/vignettes/cookbook/_annotations.Rmd b/vignettes/cookbook/_annotations.Rmd index 0c4f0a2..c87354f 100644 --- a/vignettes/cookbook/_annotations.Rmd +++ b/vignettes/cookbook/_annotations.Rmd @@ -87,7 +87,7 @@ Annotations may also be used to add value labels to a bar chart. Note that `geom ggplot(bar_data, aes(x = reorder(country, -lifeExp), y = lifeExp)) + geom_col(fill = sg_colour_values["dark-blue"]) + - geom_text(aes(label = round(lifeExp, 1)), + geom_text(aes(label = round(lifeExp, 1)), nudge_y = -5, colour = "white") + theme_sg() + scale_y_continuous(expand = c(0, 0)) +