Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d8b251d
Add link to gov.scot (closes #60)
alice-hannah Jul 23, 2025
fc80fbe
Update font-awesome coding
alice-hannah Jul 23, 2025
b4ac18d
Change data used in readme bar charts (#37)
alice-hannah Jul 24, 2025
c5baecb
Update bar chart examples in cookbook (#37)
alice-hannah Jul 24, 2025
7f4d515
Re-build README.md
alice-hannah Jul 24, 2025
b069298
Simplify scale controls for examples
alice-hannah Jul 29, 2025
816b798
Fix typo
alice-hannah Jul 29, 2025
33d033d
Merge branch 'improve-pkgdown' of github.com:ScotGovAnalysis/sgplot i…
alice-hannah Jul 29, 2025
943f5c9
Tweak subtitle/axis label
alice-hannah Jul 30, 2025
c9ed93b
Restructure preamble (#56)
alice-hannah Jul 30, 2025
613ba6e
Add link to AF guidance on chart titles
alice-hannah Jul 30, 2025
15f9d3b
Convert vignettes to articles (closes #66)
alice-hannah Jul 30, 2025
05c83e9
Convert vignettes to articles (closes #66)
alice-hannah Jul 30, 2025
3ab38f9
Merge branch 'improve-pkgdown' of github.com:ScotGovAnalysis/sgplot i…
alice-hannah Jul 30, 2025
2ffc9fe
Fix broken link
alice-hannah Jul 31, 2025
064bd69
Remove size aes from scatterplot
alice-hannah Jul 31, 2025
5566a3f
Remove colour from labels (use black) and adjust max label on x-axis
alice-hannah Jul 31, 2025
036d85e
Make hline grey (instead of turquoise) and reorder layers
alice-hannah Aug 1, 2025
19ffaad
Hyphenate x and y axis
alice-hannah Aug 1, 2025
1d55219
Move legend to right
alice-hannah Aug 1, 2025
2ea8046
Refine and reorder customisations content
alice-hannah Aug 1, 2025
703b2a3
Use relative links within pkgdown site (closes #43)
alice-hannah Aug 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
^Meta$
^cran-comments\.md$
^CRAN-SUBMISSION$
^vignettes/articles$
15 changes: 3 additions & 12 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,13 @@ Imports:
lifecycle,
rlang,
scales
Suggests:
Suggests:
dplyr,
gapminder,
glue,
gt,
knitr,
plotly,
purrr,
rmarkdown,
stringr,
testthat (>= 2.1.0),
tibble,
tidyr
VignetteBuilder:
knitr
tibble
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
Config/Needs/website: rmarkdown
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# sgplot (development version)

* Vignettes are converted to articles. Vignettes are now not available to view
locally and only via the
[pkgdown site](https://scotgovanalysis.github.io/sgplot/) (#66).

* Set minimum version of ggplot (>= 3.5.0) (#62).

* Fix bug where `use_sgplot()` could not handle passing multiple arguments of
Expand Down
31 changes: 19 additions & 12 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,25 @@ The easiest way to use sgplot is by adding `use_sgplot()` to the beginning of yo
#### Example 1: Plot with one colour using ggplot2 defaults

```{r ex1, fig.alt = ex1_alt}
library(sgplot)
library(ggplot2)
library(dplyr)
library(gapminder)

gapminder |>
filter(year == 2007 & continent == "Europe") |>
slice_max(order_by = lifeExp, n = 5) |>
filter(year == 2007 & continent == "Americas") |>
slice_max(order_by = pop, n = 5) |>
ggplot() +
geom_col(aes(x = reorder(country, -lifeExp), y = lifeExp)) +
scale_y_continuous(expand = c(0, 0)) +
geom_col(aes(x = reorder(country, -pop), y = pop)) +
scale_y_continuous(
labels = scales::label_number(scale = 1E-6),
expand = c(0, 0)
) +
labs(
x = NULL,
y = NULL,
title = "Iceland has the highest life expectancy in Europe",
subtitle = "Life expectancy in European countries, 2007",
title = "The United States is the most populous country in the Americas",
subtitle = "Population of countries in the Americas (millions), 2007",
caption = "Source: Gapminder"
)
```
Expand All @@ -110,16 +114,19 @@ gapminder |>
sgplot::use_sgplot()

gapminder |>
filter(year == 2007 & continent == "Europe") |>
slice_max(order_by = lifeExp, n = 5) |>
filter(year == 2007 & continent == "Americas") |>
slice_max(order_by = pop, n = 5) |>
ggplot() +
geom_col(aes(x = reorder(country, -lifeExp), y = lifeExp)) +
scale_y_continuous(expand = c(0, 0)) +
geom_col(aes(x = reorder(country, -pop), y = pop)) +
scale_y_continuous(
labels = scales::label_number(scale = 1E-6),
expand = c(0, 0)
) +
labs(
x = NULL,
y = NULL,
title = "Iceland has the highest life expectancy in Europe",
subtitle = "Life expectancy in European countries, 2007",
title = "The United States is the most populous country \nin the Americas",
subtitle = "Population of countries in the Americas (millions), 2007",
caption = "Source: Gapminder"
)
```
Expand Down
31 changes: 19 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,25 @@ colour palettes and use `theme_sg()`.
#### Example 1: Plot with one colour using ggplot2 defaults

``` r
library(sgplot)
library(ggplot2)
library(dplyr)
library(gapminder)

gapminder |>
filter(year == 2007 & continent == "Europe") |>
slice_max(order_by = lifeExp, n = 5) |>
filter(year == 2007 & continent == "Americas") |>
slice_max(order_by = pop, n = 5) |>
ggplot() +
geom_col(aes(x = reorder(country, -lifeExp), y = lifeExp)) +
scale_y_continuous(expand = c(0, 0)) +
geom_col(aes(x = reorder(country, -pop), y = pop)) +
scale_y_continuous(
labels = scales::label_number(scale = 1E-6),
expand = c(0, 0)
) +
labs(
x = NULL,
y = NULL,
title = "Iceland has the highest life expectancy in Europe",
subtitle = "Life expectancy in European countries, 2007",
title = "The United States is the most populous country in the Americas",
subtitle = "Population of countries in the Americas (millions), 2007",
caption = "Source: Gapminder"
)
```
Expand All @@ -106,16 +110,19 @@ gapminder |>
sgplot::use_sgplot()

gapminder |>
filter(year == 2007 & continent == "Europe") |>
slice_max(order_by = lifeExp, n = 5) |>
filter(year == 2007 & continent == "Americas") |>
slice_max(order_by = pop, n = 5) |>
ggplot() +
geom_col(aes(x = reorder(country, -lifeExp), y = lifeExp)) +
scale_y_continuous(expand = c(0, 0)) +
geom_col(aes(x = reorder(country, -pop), y = pop)) +
scale_y_continuous(
labels = scales::label_number(scale = 1E-6),
expand = c(0, 0)
) +
labs(
x = NULL,
y = NULL,
title = "Iceland has the highest life expectancy in Europe",
subtitle = "Life expectancy in European countries, 2007",
title = "The United States is the most populous country \nin the Americas",
subtitle = "Population of countries in the Americas (millions), 2007",
caption = "Source: Gapminder"
)
```
Expand Down
12 changes: 8 additions & 4 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,23 @@ authors:
Alice Hannah:
html: "Alice Hannah  \
<a href='mailto:alice.hannah@gov.scot'>\
<i class='fas fa-envelope' aria-hidden='true'></i>\
<i class='fa-solid fa-envelope' aria-hidden='true'></i>\
<span class='visually-hidden'>Email Alice Hannah></span></a>&nbsp;&nbsp;\
<a href='https://github.com/alice-hannah'>\
<i class='fab fa-github' aria-hidden='true'></i>\
<i class='fa-brands fa-github' aria-hidden='true'></i>\
<span class='visually-hidden'>Alice Hannah GitHub profile></span></a>"
Scottish Government:
html: "Scottish Government&nbsp;&nbsp;\
<a href='https://www.gov.scot'>\
<i class='fa-solid fa-arrow-pointer' aria-hidden='true'></i>\
<span class='visually-hidden'>Scottish Government Website></span>\
</a>&nbsp;&nbsp;\
<a href='mailto:statistics.enquiries@gov.scot'>\
<i class='fas fa-envelope' aria-hidden='true'></i>\
<i class='fa-solid fa-envelope' aria-hidden='true'></i>\
<span class='visually-hidden'>Email Scottish Government></span></a>\
&nbsp;&nbsp;\
<a href='https://github.com/scotgovanalysis'>\
<i class='fab fa-github' aria-hidden='true'></i>\
<i class='fa-brands fa-github' aria-hidden='true'></i>\
<span class='visually-hidden'>Scottish Government GitHub profile></span>\
</a>"
sidebar:
Expand Down
Loading
Loading