diff --git a/.gitignore b/.gitignore
index 234f028..0d7f03b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@
.RData
.Ruserdata
docs
+inst/doc
diff --git a/DESCRIPTION b/DESCRIPTION
index ce61aaa..0cf82f3 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -20,6 +20,8 @@ Imports:
withr
Suggests:
covr,
+ knitr,
+ rmarkdown,
sf,
spelling,
testthat (>= 3.0.0)
@@ -31,3 +33,4 @@ Roxygen: list(markdown = TRUE)
URL: https://oxford-ihtm.io/oxthema/,https://github.com/OxfordIHTM/oxthema
BugReports: https://github.com/OxfordIHTM/oxthema/issues
Config/testthat/edition: 3
+VignetteBuilder: knitr
diff --git a/R/oxford_palettes.R b/R/oxford_palettes.R
index 8da1fb7..fb2f246 100644
--- a/R/oxford_palettes.R
+++ b/R/oxford_palettes.R
@@ -4,7 +4,7 @@
#' @examples
#' oxford_theme_palettes()
#'
-#' @rdname oxford_theme
+#' @rdname oxford_palette
#' @export
#'
oxford_theme_palettes <- function() {
@@ -34,7 +34,7 @@ oxford_theme_palettes <- function() {
#' @examples
#' oxford_brewer_palettes()
#'
-#' @rdname oxford_brewer_palette
+#' @rdname oxford_palette
#' @export
#'
oxford_brewer_palettes <- function() {
diff --git a/R/oxford_theme.R b/R/oxford_theme.R
index 08473d7..c4df7b7 100644
--- a/R/oxford_theme.R
+++ b/R/oxford_theme.R
@@ -1,5 +1,5 @@
#'
-#' A generic/base [ggplot2] theme for the oxfordtheme package
+#' A generic/base [ggplot2] theme for the oxthema package
#'
#' This generic/base [ggplot2] theme is the template from which all other
#' themes in the [oxthema] package is built on. This theme is inspired by
diff --git a/README.Rmd b/README.Rmd
index e2b53ea..ab39150 100644
--- a/README.Rmd
+++ b/README.Rmd
@@ -53,234 +53,14 @@ install.packages(
## Usage
-### Oxford colours
+The following vignettes provide details on how to make full use of the `oxthema` package:
-Based on the [University of Oxford](https://ox.ac.uk)'s [visual identity guidelines](https://communications.web.ox.ac.uk/communications-resources/visual-identity/identity-guidelines), the following colours are available from this package:
+* [Oxford colours](https://oxford-ihtm.io/oxthema/articles/oxford-colours.html)
-```{r oxford-colours, echo = FALSE}
-oxford_colours |>
- knitr::kable()
-```
-
-```{r oxford-colours-graphic, echo = FALSE, fig.height = 1, fig.align = "center"}
-structure(get_oxford_colours() |> (\(x) x[x != ""])(), class = "palette", name = "Oxford Colours")
-```
-
-You can access either the name, RGB, CMYK, hex code, and/or Pantone values of each Oxford colour through the `get_oxford_colours()` function as follows:
-
-```{r get-colours}
-## Get hex code for Oxford blue
-get_oxford_colours(pattern = "Oxford blue")
-
-## Get hex code for all colours with "blue" in their name (show name in output)
-get_oxford_colours(pattern = "blue", named = TRUE)
-```
-
-The `get_oxford_colours()` function can thus be used to create your own bespoke combination of colours from the Oxford colours palette and create your own theme (see next section for University of Oxford officially recommended themes using the Oxford colours).
-
-### Oxford palettes
-
-Based on the [University of Oxford](https://ox.ac.uk)'s [visual identity guidelines](https://communications.web.ox.ac.uk/communications-resources/visual-identity/identity-guidelines) and the carefully curated colour groups of the official University [theme packs](https://communications.web.ox.ac.uk/communications-resources/visual-identity/identity-guidelines/theme-packs), the following palettes are available from this package:
-
-#### Heritage
-
-```{r oxford-palettes-heritage-code}
-oxford_theme_palettes()$heritage
-```
-
-```{r oxford-palettes-heritage-show, echo = FALSE, fig.height = 1, fig.align = "center"}
-structure(oxford_theme_palettes()$heritage, class = "palette", name = "heritage")
-```
-
-#### Contemporary
-
-```{r oxford-palettes-contemporary-code}
-oxford_theme_palettes()$contemporary
-```
-
-```{r oxford-palettes-contemporary-show, echo = FALSE, fig.height = 1, fig.align = "center"}
-structure(oxford_theme_palettes()$contemporary, class = "palette", name = "contemporary")
-```
-
-#### Celebratory
-
-```{r oxford-palettes-celebratory-code}
-oxford_theme_palettes()$celebratory
-```
-
-```{r oxford-palettes-celebratory-show, echo = FALSE, fig.height = 1, fig.align = "center"}
-structure(oxford_theme_palettes()$celebratory, class = "palette", name = "celebratory")
-```
-
-#### Corporate
-
-```{r oxford-palettes-corporate-code}
-oxford_theme_palettes()$corporate
-```
-
-```{r oxford-palettes-corporate-show, echo = FALSE, fig.height = 1, fig.align = "center"}
-structure(oxford_theme_palettes()$corporate, class = "palette", name = "corporate")
-```
-
-#### Innovative
-
-```{r oxford-palettes-innovative-code}
-oxford_theme_palettes()$innovative
-```
-
-```{r oxford-palettes-innovative-show, echo = FALSE, fig.height = 1, fig.align = "center"}
-structure(oxford_theme_palettes()$innovative, class = "palette", name = "innovative")
-```
-
-### Oxford theme palettes for use in plotting
-
-The University of Oxford recommended theme palettes can be used for plotting. Below is code examples of how this can be done both with base R plotting function and with `ggplot2`.
-
-#### Bar plots in base R and using `ggplot`
-
-```{r mtcars-barplot, fig.show = "hold", fig.height = 8, out.width = "50%"}
-## Barplot of cyl and vs of mtcars dataset using heritage Oxford theme
-
-### Base R
-table(mtcars$cyl, mtcars$vs) |>
- barplot(
- names.arg = c("v-shaped", "straight"),
- main = "Engine shape by number of cylinders",
- ylab = "n",
- legend.text = TRUE,
- col = oxford_theme_palettes()$heritage,
- args.legend = list(
- x = "topright",
- inset = 0.002,
- title = "Cylinders",
- bty = "n"
- )
- )
-
-### ggplot2
-ggplot(
- data = mtcars,
- mapping = aes(
- x = factor(vs, levels = c(0, 1), labels = c("v-shaped", "straight")),
- fill = factor(cyl)
- )
- ) +
- geom_bar() +
- scale_fill_manual(name = "Cylinders", values = oxford_theme_palettes()$heritage) +
- labs(
- title = "This title is in Oxford Blue",
- subtitle = "This subtitle is in Oxford ash grey",
- x = "Engine shape",
- y = "Counts"
- ) +
- theme_oxford()
-```
-
-#### Scatter plots in base R and using `ggplot`
+* [Oxford palettes](https://oxford-ihtm.io/oxthema/articles/oxford-palettes.html)
-```{r mtcars-scatterplot, fig.show = "hold", fig.height = 8, out.width = "50%"}
-## Scatterplot of mpg and disp of mtcars dataset using celebratory Oxford theme
+* [Oxford theme](https://oxford-ihtm.io/oxthema/articles/oxford-theme.html)
-### Base R
-plot(
- x = mtcars$mpg,
- y = mtcars$disp,
- pch = 19, cex = 1.75,
- col = ifelse(
- mtcars$cyl == 4, oxford_theme_palettes()$celebratory[1],
- ifelse(
- mtcars$cyl == 6, oxford_theme_palettes()$celebratory[2],
- oxford_theme_palettes()$celebratory[3]
- )
- ),
- main = "mpg by disp grouped by cyl",
- xlab = "mpg", ylab = "disp",
- frame.plot = FALSE
-)
-legend(
- x = "topright", inset = 0.02,
- title = "Cylinders",
- legend = c("4", "6", "8"),
- pch = 19, pt.cex = 1.5, bty = "n",
- col = oxford_theme_palettes()$celebratory[1:3]
-)
-
-### ggplot2
-ggplot(data = mtcars, mapping = aes(x = mpg, y = disp, colour = factor(cyl))) +
- geom_point(size = 5) +
- scale_colour_manual(
- name = "Cylinders",
- values = oxford_theme_palettes()$celebratory
- ) +
- labs(
- title = "This title is in Oxford Blue",
- subtitle = "This subtitle is in Oxford Ash Grey"
- ) +
- theme_oxford()
-```
-
-#### Plotting maps using Oxford palettes
-
-```{r oxford-palette-sequential, fig.show = "hold", out.width = "50%", fig.height = 8}
-## Plot acute malnutrition using Oxford sequential palette
-
-### Yellow-Orange-Brown
-ggplot(data = nut_survey_map) +
- geom_sf(mapping = aes(fill = muac_mam)) +
- scale_fill_gradientn(
- name = "",
- colours = create_palette_sequential(n = 9, name = "ylorbr")
- ) +
- labs(
- title = "Prevalence of moderate child wasting",
- subtitle = "Sequential Yellow-Orange-Brown Colour Palette"
- ) +
- theme_oxford()
-
-### Yellow-Green-Blue
-ggplot(data = nut_survey_map) +
- geom_sf(mapping = aes(fill = muac_sam)) +
- scale_fill_gradientn(
- name = "",
- colours = create_palette_sequential(n = 9, name = "ylgnbu")
- ) +
- labs(
- title = "Prevalence of severe child wasting",
- subtitle = "Sequential Yellow-Green-Blue Colour Palette"
- ) +
- theme_oxford()
-```
-
-
-```{r oxford-palette-divergent, fig.show = "hold", out.width = "50%", fig.height = 8}
-## Plot period prevalence of fever and diarrhoea using Oxford divergent palette
-
-### Pink-Yellow-Green
-ggplot(data = nut_survey_map) +
- geom_sf(mapping = aes(fill = fev)) +
- scale_fill_gradientn(
- name = "",
- colours = create_palette_divergent(n = 11, name = "piylgn")
- ) +
- labs(
- title = "Period prevalence of childhood fever",
- subtitle = "Divergent Pink-Yellow-Green Colour Palette"
- ) +
- theme_oxford()
-
-### Purple-Green
-ggplot(data = nut_survey_map) +
- geom_sf(mapping = aes(fill = dia)) +
- scale_fill_gradientn(
- name = "",
- colours = create_palette_divergent(n = 11, name = "prgn")
- ) +
- labs(
- title = "Period prevalence of childhood diarrhoea",
- subtitle = "Divergent Purple-Green Colour Palette"
- ) +
- theme_oxford()
-```
## Authors
diff --git a/README.md b/README.md
index c4cab35..abe4ba8 100644
--- a/README.md
+++ b/README.md
@@ -54,285 +54,17 @@ install.packages(
## Usage
-### Oxford colours
+The following vignettes provide details on how to make full use of the
+`oxthema` package:
-Based on the [University of Oxford](https://ox.ac.uk)’s [visual identity
-guidelines](https://communications.web.ox.ac.uk/communications-resources/visual-identity/identity-guidelines),
-the following colours are available from this package:
+- [Oxford
+ colours](https://oxford-ihtm.io/oxthema/articles/oxford-colours.html)
-| name | rgb | cmyk | hex | pantone |
-|:---------------------|:--------------|:----------------|:---------|:--------------|
-| Oxford blue | 0, 33, 71 | 100, 87, 42, 51 | \#002147 | 282 |
-| Oxford mauve | 119, 104, 133 | 58, 60, 27, 10 | \#776885 | 667C |
-| Oxford peach | 224, 141, 121 | 2, 58, 51, 0 | \#E08D79 | 4051C |
-| Oxford potters pink | 237, 147, 144 | 0, 57, 34, 0 | \#ED9390 | 2339C |
-| Oxford dusk | 196, 162, 158 | 20, 40, 31, 5 | \#C4A29E | 6030C |
-| Oxford lilac | 209, 189, 213 | 18, 30, 4, 0 | \#D1BDD5 | 524C |
-| Oxford sienna | 153, 70, 54 | 25, 82, 80, 19 | \#994636 | 4036C |
-| Oxford CCB red | 127, 5, 95 | 48, 100, 19, 15 | \#AA1A2D | 187C |
-| Oxford plum | 127, 5, 95 | 48, 100, 19, 15 | \#7F055F | 2425C |
-| Oxford coral | 254, 97, 90 | 0, 79, 56, 0 | \#FE615A | 178C |
-| Oxford lavender | 212, 205, 244 | 19, 22, 0, 0 | \#D4CDF4 | 2635C |
-| Oxford orange | 251, 86, 7 | 0, 76, 95, 0 | \#FB5607 | 1655C |
-| Oxford pink | 230, 0, 126 | 0, 100, 0, 0 | \#E6007E | 2385C |
-| Oxford green | 66, 106, 90 | 79, 35, 64, 26 | \#426A5A | 5545C |
-| Oxford ocean grey | 120, 158, 158 | 61, 22, 37, 4 | \#789E9E | 2211C |
-| Oxford yellow ochre | 226, 192, 68 | 10, 23, 93, 1 | \#E2C044 | 4016C |
-| Oxford cool grey | 228, 240, 239 | 15, 0, 8, 0 | \#E4F0EF | 7541C |
-| Oxford sky blue | 185, 214, 242 | 34, 6, 0, 0 | \#B9D6F2 | 277C |
-| Oxford sage green | 160, 175, 132 | 45, 19, 58, 3 | \#A0AF84 | 7494C |
-| Oxford viridian | 21, 97, 109 | 92, 36, 43, 27 | \#15616D | 5473C |
-| Oxford royal blue | 29, 66, 166 | 96, 75, 0, 0 | \#1D42A6 | 2126C |
-| Oxford aqua | 0, 170, 180 | 84, 0, 33, 0 | \#00AAB4 | 7710C |
-| Oxford vivid green | 101, 229, 174 | 56, 0, 46, 0 | \#65E5AE | 3385C |
-| Oxford lime green | 149, 193, 31 | 54, 0, 100, 0 | \#95C11F | 2292C |
-| Oxford cerulean blue | 73, 182, 255 | 68, 11, 0, 0 | \#49B6FF | 292C |
-| Oxford lemon yellow | 247, 239, 102 | 8, 0, 69, 0 | \#F7EF66 | 3935C |
-| Oxford charcoal | 33, 29, 28 | 70, 67, 61, 81 | \#211D1C | 419 C |
-| Oxford ash grey | 97, 97, 95 | 57, 46, 48, 36 | \#61615F | 6215 C |
-| Oxford umber | 137, 130, 122 | 43, 39, 43, 22 | \#89827A | 403 C |
-| Oxford stone grey | 217, 216, 214 | 17, 13, 15, 0 | \#D9D8D6 | Cool Gray 1 C |
-| Oxford shell grey | 241, 238, 233 | 6, 6, 9, 0 | \#F1EEE9 | Warm Gray 1 C |
-| Oxford off white | 242, 240, 240 | 6, 6, 6, 0 | \#F2F0F0 | 663 C |
-| Gold | | | | 10122C |
-| Silver | | | | 10103C |
+- [Oxford
+ palettes](https://oxford-ihtm.io/oxthema/articles/oxford-palettes.html)
-
-
-You can access either the name, RGB, CMYK, hex code, and/or Pantone
-values of each Oxford colour through the `get_oxford_colours()` function
-as follows:
-
-``` r
-## Get hex code for Oxford blue
-get_oxford_colours(pattern = "Oxford blue")
-#> [1] "#002147"
-
-## Get hex code for all colours with "blue" in their name (show name in output)
-get_oxford_colours(pattern = "blue", named = TRUE)
-#> Oxford blue Oxford sky blue Oxford royal blue
-#> "#002147" "#B9D6F2" "#1D42A6"
-#> Oxford cerulean blue
-#> "#49B6FF"
-```
-
-The `get_oxford_colours()` function can thus be used to create your own
-bespoke combination of colours from the Oxford colours palette and
-create your own theme (see next section for University of Oxford
-officially recommended themes using the Oxford colours).
-
-### Oxford palettes
-
-Based on the [University of Oxford](https://ox.ac.uk)’s [visual identity
-guidelines](https://communications.web.ox.ac.uk/communications-resources/visual-identity/identity-guidelines)
-and the carefully curated colour groups of the official University
-[theme
-packs](https://communications.web.ox.ac.uk/communications-resources/visual-identity/identity-guidelines/theme-packs),
-the following palettes are available from this package:
-
-#### Heritage
-
-``` r
-oxford_theme_palettes()$heritage
-#> [1] "#994636" "#E08D79" "#C4A29E" "#A0AF84" "#426A5A"
-```
-
-
-
-#### Contemporary
-
-``` r
-oxford_theme_palettes()$contemporary
-#> [1] "#FE615A" "#ED9390" "#E4F0EF" "#789E9E" "#00AAB4"
-```
-
-
-
-#### Celebratory
-
-``` r
-oxford_theme_palettes()$celebratory
-#> [1] "#15616D" "#776885" "#E2C044" "#D4CDF4" "#7F055F"
-```
-
-
-
-#### Corporate
-
-``` r
-oxford_theme_palettes()$corporate
-#> [1] "#FB5607" "#B9D6F2" "#95C11F" "#49B6FF" "#1D42A6"
-```
-
-
-
-#### Innovative
-
-``` r
-oxford_theme_palettes()$innovative
-#> [1] "#65E5AE" "#F7EF66" "#15616D" "#D4CDF4" "#E6007E"
-```
-
-
-
-### Oxford theme palettes for use in plotting
-
-The University of Oxford recommended theme palettes can be used for
-plotting. Below is code examples of how this can be done both with base
-R plotting function and with `ggplot2`.
-
-#### Bar plots in base R and using `ggplot`
-
-``` r
-## Barplot of cyl and vs of mtcars dataset using heritage Oxford theme
-
-### Base R
-table(mtcars$cyl, mtcars$vs) |>
- barplot(
- names.arg = c("v-shaped", "straight"),
- main = "Engine shape by number of cylinders",
- ylab = "n",
- legend.text = TRUE,
- col = oxford_theme_palettes()$heritage,
- args.legend = list(
- x = "topright",
- inset = 0.002,
- title = "Cylinders",
- bty = "n"
- )
- )
-
-### ggplot2
-ggplot(
- data = mtcars,
- mapping = aes(
- x = factor(vs, levels = c(0, 1), labels = c("v-shaped", "straight")),
- fill = factor(cyl)
- )
- ) +
- geom_bar() +
- scale_fill_manual(name = "Cylinders", values = oxford_theme_palettes()$heritage) +
- labs(
- title = "This title is in Oxford Blue",
- subtitle = "This subtitle is in Oxford ash grey",
- x = "Engine shape",
- y = "Counts"
- ) +
- theme_oxford()
-```
-
-
-
-#### Scatter plots in base R and using `ggplot`
-
-``` r
-## Scatterplot of mpg and disp of mtcars dataset using celebratory Oxford theme
-
-### Base R
-plot(
- x = mtcars$mpg,
- y = mtcars$disp,
- pch = 19, cex = 1.75,
- col = ifelse(
- mtcars$cyl == 4, oxford_theme_palettes()$celebratory[1],
- ifelse(
- mtcars$cyl == 6, oxford_theme_palettes()$celebratory[2],
- oxford_theme_palettes()$celebratory[3]
- )
- ),
- main = "mpg by disp grouped by cyl",
- xlab = "mpg", ylab = "disp",
- frame.plot = FALSE
-)
-legend(
- x = "topright", inset = 0.02,
- title = "Cylinders",
- legend = c("4", "6", "8"),
- pch = 19, pt.cex = 1.5, bty = "n",
- col = oxford_theme_palettes()$celebratory[1:3]
-)
-
-### ggplot2
-ggplot(data = mtcars, mapping = aes(x = mpg, y = disp, colour = factor(cyl))) +
- geom_point(size = 5) +
- scale_colour_manual(
- name = "Cylinders",
- values = oxford_theme_palettes()$celebratory
- ) +
- labs(
- title = "This title is in Oxford Blue",
- subtitle = "This subtitle is in Oxford Ash Grey"
- ) +
- theme_oxford()
-```
-
-
-
-#### Plotting maps using Oxford palettes
-
-``` r
-## Plot acute malnutrition using Oxford sequential palette
-
-### Yellow-Orange-Brown
-ggplot(data = nut_survey_map) +
- geom_sf(mapping = aes(fill = muac_mam)) +
- scale_fill_gradientn(
- name = "",
- colours = create_palette_sequential(n = 9, name = "ylorbr")
- ) +
- labs(
- title = "Prevalence of moderate child wasting",
- subtitle = "Sequential Yellow-Orange-Brown Colour Palette"
- ) +
- theme_oxford()
-
-### Yellow-Green-Blue
-ggplot(data = nut_survey_map) +
- geom_sf(mapping = aes(fill = muac_sam)) +
- scale_fill_gradientn(
- name = "",
- colours = create_palette_sequential(n = 9, name = "ylgnbu")
- ) +
- labs(
- title = "Prevalence of severe child wasting",
- subtitle = "Sequential Yellow-Green-Blue Colour Palette"
- ) +
- theme_oxford()
-```
-
-
-
-``` r
-## Plot period prevalence of fever and diarrhoea using Oxford divergent palette
-
-### Pink-Yellow-Green
-ggplot(data = nut_survey_map) +
- geom_sf(mapping = aes(fill = fev)) +
- scale_fill_gradientn(
- name = "",
- colours = create_palette_divergent(n = 11, name = "piylgn")
- ) +
- labs(
- title = "Period prevalence of childhood fever",
- subtitle = "Divergent Pink-Yellow-Green Colour Palette"
- ) +
- theme_oxford()
-
-### Purple-Green
-ggplot(data = nut_survey_map) +
- geom_sf(mapping = aes(fill = dia)) +
- scale_fill_gradientn(
- name = "",
- colours = create_palette_divergent(n = 11, name = "prgn")
- ) +
- labs(
- title = "Period prevalence of childhood diarrhoea",
- subtitle = "Divergent Purple-Green Colour Palette"
- ) +
- theme_oxford()
-```
-
-
+- [Oxford
+ theme](https://oxford-ihtm.io/oxthema/articles/oxford-theme.html)
## Authors
diff --git a/man/oxford_brewer_palette.Rd b/man/oxford_palette.Rd
similarity index 51%
rename from man/oxford_brewer_palette.Rd
rename to man/oxford_palette.Rd
index 047ff24..d8d2962 100644
--- a/man/oxford_brewer_palette.Rd
+++ b/man/oxford_palette.Rd
@@ -1,15 +1,22 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/oxford_palettes.R
-\name{oxford_brewer_palettes}
+\name{oxford_theme_palettes}
+\alias{oxford_theme_palettes}
\alias{oxford_brewer_palettes}
-\title{Oxford base map palettes}
+\title{Oxford theme palettes from visual identity guidelines}
\usage{
+oxford_theme_palettes()
+
oxford_brewer_palettes()
}
\description{
+Oxford theme palettes from visual identity guidelines
+
Oxford base map palettes
}
\examples{
+oxford_theme_palettes()
+
oxford_brewer_palettes()
}
diff --git a/man/oxford_theme.Rd b/man/oxford_theme.Rd
index acc21b2..9be0e23 100644
--- a/man/oxford_theme.Rd
+++ b/man/oxford_theme.Rd
@@ -1,12 +1,9 @@
% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/oxford_palettes.R, R/oxford_theme.R
-\name{oxford_theme_palettes}
-\alias{oxford_theme_palettes}
+% Please edit documentation in R/oxford_theme.R
+\name{theme_oxford}
\alias{theme_oxford}
-\title{Oxford theme palettes from visual identity guidelines}
+\title{A generic/base \link{ggplot2} theme for the oxthema package}
\usage{
-oxford_theme_palettes()
-
theme_oxford(
base_family = "Roboto",
base_size = 11.5,
@@ -158,7 +155,3 @@ drawing heavily on its typography-centric focus. This function uses the
\emph{Roboto} Google font which is the core Oxford san serif font. It is freely
downloadable and easily installed on any system.
}
-\examples{
-oxford_theme_palettes()
-
-}
diff --git a/pkgdown/_pkgdown.yml b/pkgdown/_pkgdown.yml
index 5b7d548..ed5a1f6 100644
--- a/pkgdown/_pkgdown.yml
+++ b/pkgdown/_pkgdown.yml
@@ -21,17 +21,15 @@ navbar:
right: [twitter, facebook, linkedin, github]
components:
- # articles:
- # text: Articles
- # menu:
- # - text: "ICD-11 Foundation"
- # href: articles/icd11_foundation.html
- # - text: "Detecting inflammation"
- # href: articles/inflammation.html
- # - text: "Detecting iron deficiency"
- # href: articles/iron-deficiency.html
- # - text: "Detecting iodine deficiency"
- # href: articles/iodine-deficiency.html
+ articles:
+ text: Articles
+ menu:
+ - text: "Oxford Colours"
+ href: articles/oxford-colours.html
+ - text: "Oxford Palettes"
+ href: articles/oxford-palettes.html
+ - text: "Oxford Theme"
+ href: articles/oxford-theme.html
twitter:
icon: "fab fa-twitter fa-lg"
href: http://twitter.com/OxIHTM
@@ -48,27 +46,28 @@ reference:
contents:
- oxthema
+ - title: Colours
+ contents:
+ - get_oxford_colour
+ - get_oxford_colours
+
- title: Palettes
contents:
- oxford_theme_palettes
- oxford_brewer_palettes
+ - create_palette_sequential
+ - create_palette_divergent
+ - create_palette_qualitative
+ - create_brewer_palette
- title: Fonts
contents:
- oxford_fonts
- check_oxford_fonts
- - title: Create palettes
+ - title: Themes
contents:
- - create_palette_sequential
- - create_palette_divergent
- - create_palette_qualitative
- - create_brewer_palette
-
- - title: Get colours
- contents:
- - get_oxford_colour
- - get_oxford_colours
+ - theme_oxford
- title: Utilities
contents:
diff --git a/vignettes/.gitignore b/vignettes/.gitignore
new file mode 100644
index 0000000..097b241
--- /dev/null
+++ b/vignettes/.gitignore
@@ -0,0 +1,2 @@
+*.html
+*.R
diff --git a/vignettes/oxford-colours.Rmd b/vignettes/oxford-colours.Rmd
new file mode 100644
index 0000000..3e1be59
--- /dev/null
+++ b/vignettes/oxford-colours.Rmd
@@ -0,0 +1,42 @@
+---
+title: "Oxford Colours"
+output: rmarkdown::html_vignette
+vignette: >
+ %\VignetteIndexEntry{Oxford Colours}
+ %\VignetteEngine{knitr::rmarkdown}
+ %\VignetteEncoding{UTF-8}
+---
+
+```{r, include = FALSE}
+knitr::opts_chunk$set(
+ collapse = TRUE,
+ comment = "#>"
+)
+```
+
+```{r setup, echo = FALSE}
+library(oxthema)
+```
+
+Based on the [University of Oxford](https://ox.ac.uk)'s [visual identity guidelines](https://communications.web.ox.ac.uk/communications-resources/visual-identity/identity-guidelines), the following colours are available from this package:
+
+```{r oxford-colours, echo = FALSE}
+oxford_colours |>
+ knitr::kable()
+```
+
+```{r oxford-colours-graphic, echo = FALSE, fig.height = 1, fig.align = "center"}
+structure(get_oxford_colours() |> (\(x) x[x != ""])(), class = "palette", name = "Oxford Colours")
+```
+
+You can access either the name, RGB, CMYK, hex code, and/or Pantone values of each Oxford colour through the `get_oxford_colours()` function as follows:
+
+```{r get-colours}
+## Get hex code for Oxford blue
+get_oxford_colours(pattern = "Oxford blue")
+
+## Get hex code for all colours with "blue" in their name (show name in output)
+get_oxford_colours(pattern = "blue", named = TRUE)
+```
+
+The `get_oxford_colours()` function can thus be used to create your own bespoke combination of colours from the Oxford colours palette and create your own theme (see next section for University of Oxford officially recommended themes using the Oxford colours).
diff --git a/vignettes/oxford-palettes.Rmd b/vignettes/oxford-palettes.Rmd
new file mode 100644
index 0000000..6728571
--- /dev/null
+++ b/vignettes/oxford-palettes.Rmd
@@ -0,0 +1,71 @@
+---
+title: "Oxford Palettes"
+output: rmarkdown::html_vignette
+vignette: >
+ %\VignetteIndexEntry{Oxford Palettes}
+ %\VignetteEngine{knitr::rmarkdown}
+ %\VignetteEncoding{UTF-8}
+---
+
+```{r, include = FALSE}
+knitr::opts_chunk$set(
+ collapse = TRUE,
+ comment = "#>"
+)
+```
+
+```{r setup, echo = FALSE}
+library(oxthema)
+```
+
+Based on the [University of Oxford](https://ox.ac.uk)'s [visual identity guidelines](https://communications.web.ox.ac.uk/communications-resources/visual-identity/identity-guidelines) and the carefully curated colour groups of the official University [theme packs](https://communications.web.ox.ac.uk/communications-resources/visual-identity/identity-guidelines/theme-packs), the following palettes are available from this package:
+
+## Heritage
+
+```{r oxford-palettes-heritage-code}
+oxford_theme_palettes()$heritage
+```
+
+```{r oxford-palettes-heritage-show, echo = FALSE, fig.height = 1, fig.align = "center"}
+structure(oxford_theme_palettes()$heritage, class = "palette", name = "heritage")
+```
+
+## Contemporary
+
+```{r oxford-palettes-contemporary-code}
+oxford_theme_palettes()$contemporary
+```
+
+```{r oxford-palettes-contemporary-show, echo = FALSE, fig.height = 1, fig.align = "center"}
+structure(oxford_theme_palettes()$contemporary, class = "palette", name = "contemporary")
+```
+
+## Celebratory
+
+```{r oxford-palettes-celebratory-code}
+oxford_theme_palettes()$celebratory
+```
+
+```{r oxford-palettes-celebratory-show, echo = FALSE, fig.height = 1, fig.align = "center"}
+structure(oxford_theme_palettes()$celebratory, class = "palette", name = "celebratory")
+```
+
+## Corporate
+
+```{r oxford-palettes-corporate-code}
+oxford_theme_palettes()$corporate
+```
+
+```{r oxford-palettes-corporate-show, echo = FALSE, fig.height = 1, fig.align = "center"}
+structure(oxford_theme_palettes()$corporate, class = "palette", name = "corporate")
+```
+
+## Innovative
+
+```{r oxford-palettes-innovative-code}
+oxford_theme_palettes()$innovative
+```
+
+```{r oxford-palettes-innovative-show, echo = FALSE, fig.height = 1, fig.align = "center"}
+structure(oxford_theme_palettes()$innovative, class = "palette", name = "innovative")
+```
diff --git a/vignettes/oxford-theme.Rmd b/vignettes/oxford-theme.Rmd
new file mode 100644
index 0000000..2a777ec
--- /dev/null
+++ b/vignettes/oxford-theme.Rmd
@@ -0,0 +1,144 @@
+---
+title: "Oxford Theme"
+output: rmarkdown::html_vignette
+vignette: >
+ %\VignetteIndexEntry{Oxford Theme}
+ %\VignetteEngine{knitr::rmarkdown}
+ %\VignetteEncoding{UTF-8}
+---
+
+```{r, include = FALSE}
+knitr::opts_chunk$set(
+ collapse = TRUE,
+ comment = "#>"
+)
+```
+
+```{r setup, echo = FALSE}
+library(oxthema)
+library(ggplot2)
+```
+
+The `oxthema` package has a generic/base [ggplot2] theme which is the template from which all other themes in the [oxthema] package is built on. This theme is inspired by Bob Rudis' [hrbrthemes](https://github.com/hrbrmstr/hrbrthemes) package drawing heavily on its typography-centric focus. This function uses the *Roboto* Google font which is the core Oxford san serif font. It is freely downloadable and easily installed on any system.
+
+## Oxford theme palettes for use in plotting
+
+The University of Oxford recommended theme palettes can be used for plotting. Below is code examples of how this can be done both with base R plotting function and with `ggplot2`.
+
+### Bar plot
+
+```{r mtcars-barplot, echo = FALSE, fig.align = "center", fig.height = 6, fig.width = 5}
+## Barplot of cyl and vs of mtcars dataset using heritage Oxford theme
+
+### ggplot2
+ggplot(
+ data = mtcars,
+ mapping = aes(
+ x = factor(vs, levels = c(0, 1), labels = c("v-shaped", "straight")),
+ fill = factor(cyl)
+ )
+ ) +
+ geom_bar() +
+ scale_fill_manual(name = "Cylinders", values = oxford_theme_palettes()$heritage) +
+ labs(
+ title = "This title is in Oxford Blue",
+ subtitle = "This subtitle is in Oxford ash grey",
+ x = "Engine shape",
+ y = "Counts"
+ ) +
+ theme_oxford()
+```
+
+### Scatter plot
+
+```{r mtcars-scatterplot, echo = FALSE, fig.align = "center", fig.height = 6, fig.width = 5}
+## Scatterplot of mpg and disp of mtcars dataset using celebratory Oxford theme
+
+### ggplot2
+ggplot(data = mtcars, mapping = aes(x = mpg, y = disp, colour = factor(cyl))) +
+ geom_point(size = 5) +
+ scale_colour_manual(
+ name = "Cylinders",
+ values = oxford_theme_palettes()$celebratory
+ ) +
+ labs(
+ title = "This title is in Oxford Blue",
+ subtitle = "This subtitle is in Oxford Ash Grey"
+ ) +
+ theme_oxford()
+```
+
+### Plotting maps using Oxford palettes
+
+#### Sequential palette
+
+```{r oxford-palette-sequential1, echo = FALSE, fig.align = "center", fig.height = 6, fig.width = 8}
+## Plot acute malnutrition using Oxford sequential palette
+
+### Yellow-Orange-Brown
+ggplot(data = nut_survey_map) +
+ geom_sf(mapping = aes(fill = muac_mam)) +
+ scale_fill_gradientn(
+ name = "",
+ colours = create_palette_sequential(n = 9, name = "ylorbr")
+ ) +
+ labs(
+ title = "Prevalence of moderate child wasting",
+ subtitle = "Sequential Yellow-Orange-Brown Colour Palette"
+ ) +
+ theme_oxford()
+```
+
+```{r oxford-palette-sequential2, echo = FALSE, fig.align = "center", fig.height = 6, fig.width = 8}
+## Plot acute malnutrition using Oxford sequential palette
+
+### Yellow-Green-Blue
+ggplot(data = nut_survey_map) +
+ geom_sf(mapping = aes(fill = muac_sam)) +
+ scale_fill_gradientn(
+ name = "",
+ colours = create_palette_sequential(n = 9, name = "ylgnbu")
+ ) +
+ labs(
+ title = "Prevalence of severe child wasting",
+ subtitle = "Sequential Yellow-Green-Blue Colour Palette"
+ ) +
+ theme_oxford()
+```
+
+#### Divergent palette
+
+```{r oxford-palette-divergent1, echo = FALSE, fig.align = "center", fig.height = 6, fig.width = 8}
+## Plot period prevalence of fever and diarrhoea using Oxford divergent palette
+
+### Pink-Yellow-Green
+ggplot(data = nut_survey_map) +
+ geom_sf(mapping = aes(fill = fev)) +
+ scale_fill_gradientn(
+ name = "",
+ colours = create_palette_divergent(n = 11, name = "piylgn")
+ ) +
+ labs(
+ title = "Period prevalence of childhood fever",
+ subtitle = "Divergent Pink-Yellow-Green Colour Palette"
+ ) +
+ theme_oxford()
+```
+
+```{r oxford-palette-divergent2, echo = FALSE, fig.align = "center", fig.height = 6, fig.width = 8}
+## Plot period prevalence of fever and diarrhoea using Oxford divergent palette
+
+### Purple-Green
+ggplot(data = nut_survey_map) +
+ geom_sf(mapping = aes(fill = dia)) +
+ scale_fill_gradientn(
+ name = "",
+ colours = create_palette_divergent(n = 11, name = "prgn")
+ ) +
+ labs(
+ title = "Period prevalence of childhood diarrhoea",
+ subtitle = "Divergent Purple-Green Colour Palette"
+ ) +
+ theme_oxford()
+```
+
diff --git a/vignettes/oxthema.Rmd b/vignettes/oxthema.Rmd
new file mode 100644
index 0000000..69090e5
--- /dev/null
+++ b/vignettes/oxthema.Rmd
@@ -0,0 +1,19 @@
+---
+title: "University of Oxford Palette, Theme and Theme Components"
+output: rmarkdown::html_vignette
+vignette: >
+ %\VignetteIndexEntry{University of Oxford Palette, Theme and Theme Components}
+ %\VignetteEngine{knitr::rmarkdown}
+ %\VignetteEncoding{UTF-8}
+---
+
+```{r, include = FALSE}
+knitr::opts_chunk$set(
+ collapse = TRUE,
+ comment = "#>"
+)
+```
+
+```{r setup, echo = FALSE}
+library(oxthema)
+```