Package 'oxthema'

Title: Oxford Colours, Palettes, Fonts, and Themes
Description: Colours, palettes, fonts, and themes based on University of Oxford's visual identity guidelines <https://communications.web.ox.ac.uk/communications-resources/visual-identity/identity-guidelines>.
Authors: Ernest Guevarra [aut, cre, cph] , Greco Malijan [aut]
Maintainer: Ernest Guevarra <[email protected]>
License: GPL (>= 3)
Version: 0.0.0.9000
Built: 2025-02-28 04:48:27 UTC
Source: https://github.com/OxfordIHTM/oxthema

Help Index


Convert CMYK to RGB

Description

Convert CMYK to RGB

Usage

cmyk2rgb(C, M, Y, K)

Arguments

C

An integer value for cyan

M

An integer value for magenta

Y

An integer value for yellow

K

An integer value for key (black)

Value

A named vector for R, G, and B for RGB

Examples

cmyk2rgb(100, 80, 0, 60)

Create new palettes based on Oxford palettes

Description

These functions apply a similar approach used and demonstrated by ColorBrewer and has been patterned after the syntax of the RColorBrewer package

Usage

create_palette_sequential(n, name)

create_palette_divergent(n, name)

create_palette_qualitative(n, name)

create_brewer_palette(n, name, type = c("sequential", "divergent"))

Arguments

n

Number of colours desired/required. Oxford palettes have at least 5 colours. All colour schemes are derived from the University of Oxford visual identity guidelines.

name

Name of Oxford palette to use

type

A character value for type of palette to use. Can be either sequential, divergent, or qualitative.

Value

A character vector of desired/required colours with length equivalent to n

Examples

create_palette_sequential(5, "blues")
create_palette_divergent(10, "brbg")
create_palette_qualitative(5, "dark")
create_brewer_palette(5, "blues")

Get named Oxford colours vector

Description

Get named Oxford colours vector

Usage

get_oxford_colour(
  pattern = NULL,
  model = c("hex", "rgb", "cmyk", "pantone"),
  named = FALSE
)

get_oxford_colours(
  pattern = NULL,
  model = c("hex", "rgb", "cmyk", "pantone"),
  named = FALSE
)

Arguments

pattern

Optional. A character value or vector to use as a search term. Default is NULL in which case all the Oxford colours are returned.

model

A character vector of colour model. Can be "rgb", "cmyk", "hex", or "pantone". Default is "hex".

named

Logical. Should the output be a named character value or vector? Default is FALSE.

Value

A character value or vector of Oxford colour/s as per model specification. If named is TRUE, returns a named character value or vector.

Examples

get_oxford_colours()
get_oxford_colours(model = "rgb")
get_oxford_colours(pattern = "lilac")
get_oxford_colours(pattern = c("lilac", "sage green"))

Example map data for showing map plotting with Oxford colours

Description

Example map data for showing map plotting with Oxford colours

Usage

nut_survey_map

Format

An sf object with 12 columns and 15 rows:

Variable Description
stateID State identifier
localityID Locality identifier
state_name State name
district District name
muac_gam Prevalence of global acute malnutrition by MUAC
muac_mam Prevalence of moderate acute malnutrition by MUAC
muac_sam Prevalence of severe acute malnutrition by MUAC
oedema Prevalence of severe acute malnutrition by oedema
dia Period prevalence of childhood diarrhoea
fev Period prevalence of childhood fever
bf Prevalence of continued breastfeeding
geom Geometry

Examples

nut_survey_map

Oxford colours based on University of Oxford's visual identity guidelines

Description

Oxford colours based on University of Oxford's visual identity guidelines

Usage

oxford_colours

Format

A data frame with 5 columns and 34 rows:

Variable Description
name Official Oxford colour name
rgb Three integers for the red, green, blue components of the RGB colour model
cmyk Four integers for the cyan, magenta, yellow, and black components of the CMYK colour model
hex Hexadecimal codes for corresponding colour
pantone Pantone colour name

Source

https://communications.web.ox.ac.uk/communications-resources/visual-identity/identity-guidelines/colours

Examples

oxford_colours

Oxford core and additional fonts

Description

Oxford core and additional fonts

Check whether Oxford fonts (core and theme) are installed and available

Usage

oxford_fonts

check_oxford_fonts()

Format

An object of class list of length 7.

Value

A list of available and not available fonts and a message indicating availability status of Oxford fonts.

Examples

check_oxford_fonts()

Oxford theme palettes from visual identity guidelines

Description

Oxford theme palettes from visual identity guidelines

Oxford base map palettes

Usage

oxford_theme_palettes()

oxford_brewer_palettes()

Examples

oxford_theme_palettes()

oxford_brewer_palettes()

Print a palette

Description

Print a palette

Usage

## S3 method for class 'palette'
print(x, ...)

Arguments

x

A character value or a vector of values of class palette.

...

Other arguments

Value

Shows image of a palette with the specified colours.

Examples

## Not run: 
  pal <- oxford_theme_palettes()$heritage
  class(pal) <- palette

## End(Not run)

A generic/base ggplot2 theme for the oxthema package

Description

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 Bob Rudis' 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.

Usage

theme_oxford(
  base_family = "Roboto",
  base_size = 11.5,
  plot_title_family = base_family,
  plot_title_size = 16,
  plot_title_face = "bold",
  plot_title_colour = get_oxford_colour("Oxford blue"),
  plot_title_margin = 10,
  subtitle_family = base_family,
  subtitle_size = 12,
  subtitle_face = "plain",
  subtitle_colour = get_oxford_colour("ash"),
  subtitle_margin = 15,
  strip_text_family = base_family,
  strip_text_size = 12,
  strip_text_face = "plain",
  caption_family = base_family,
  caption_size = 9,
  caption_face = "italic",
  caption_colour = get_oxford_colour("ash"),
  caption_margin = 10,
  axis_text_size = base_size,
  axis_title_family = subtitle_family,
  axis_title_size = 9,
  axis_title_colour = get_oxford_colour("ash"),
  axis_title_face = "plain",
  axis_title_just = "rt",
  legend_title_family = subtitle_family,
  legend_title_colour = get_oxford_colour("ash"),
  legend_text_family = subtitle_family,
  legend_text_colour = get_oxford_colour("ash"),
  plot_margin = ggplot2::margin(30, 30, 30, 30),
  plot_background_fill = NULL,
  grid_col = get_oxford_colour("umber"),
  grid = TRUE,
  axis_col = get_oxford_colour("umber"),
  axis = FALSE,
  ticks = FALSE
)

Arguments

base_family

Base font family set to Roboto by default.

base_size

Base font size. Default is 11.5.

plot_title_family

Font family to use for the plot title. Default is base_family.

plot_title_size

Plot title text size in pts. Default is 16.

plot_title_face

Font face ("plain", "italic", "bold", "bold.italic") for plot title. Default is "bold".

plot_title_colour

Colour of the plot title text. Default is Oxford Blue.

plot_title_margin

Margin at the bottom of the plot title. Default set at 10.

subtitle_family

Font family to use for the plot subtitle. Default is base_family.

subtitle_size

Plot subtitle text size in pts. Default is 12.

subtitle_face

Font face ("plain", "italic", "bold", "bold.italic") for plot subtitle. Default is "plain".

subtitle_colour

Colour of the subtitle text. Default is Oxford ash grey.

subtitle_margin

Margin at the bottom of the plot subtitle. Default set at 15.

strip_text_family

Font family to use for the facet label. Default is base_family.

strip_text_size

Facet label text size in pts. Default is 12.

strip_text_face

Font face ("plain", "italic", "bold", "bold.italic") for facet label. Default is "plain".

caption_family

Font family to use for the caption text. Default is base_family.

caption_size

Caption text size in pts. Default is 9.

caption_face

Font face ("plain", "italic", "bold", "bold.italic") for caption text. Default is "plain".

caption_colour

Colour of the caption text. Default is Oxford ash grey.

caption_margin

Margin at the top of the plot caption text. Default is set at 10.

axis_text_size

Axis text size in pts. Default is base_size.

axis_title_family

Font family to use for the axis title. Default is subtitle_family.

axis_title_size

Axis title text size in pts. Default is 9.

axis_title_colour

Colour of the axis title text. Default is Oxford ash grey.

axis_title_face

Font face ("plain", "italic", "bold", "bold.italic") for axis title. Default is "plain".

axis_title_just

Axis title font justification, one of "bl" (bottom-left), "m" (middle), "rt" (right-top). Default is "rt".

legend_title_family

Font family to use for the legend title. Default is subtitle_family.

legend_title_colour

Colour of the legend title text. Default is Oxford ash grey.

legend_text_family

Font family to use for the legend text. Default is subtitle_family.

legend_text_colour

Colour of the legend text. Default is Oxford ash grey.

plot_margin

Plot margins (specify with ggplot2::margin()).

plot_background_fill

Fill colour for the plot background. Default is NULL.

grid_col

Grid colour. Default to Oxford umber.

grid

Panel grid. Either TRUE, FALSE, or a combination of X (major x grid), x (minor x grid), Y (major y grid), and/or y (minor y grid). Default is TRUE.

axis_col

Axis colours. Default to Oxford umber.

axis

Add x or y axes? TRUE, FALSE, "xy". Default is FALSE.

ticks

Logical. Should ticks be added? Default is FALSE.

Value

A ggplot2 theme.


Oxford theme for forestploter package

Description

Oxford theme for forestploter package

Usage

theme_oxford_forest(
  base_size = 11.5,
  base_family = "Roboto",
  bg_col = get_oxford_colour("cool"),
  ci_col = get_oxford_colour("Oxford blue"),
  ci_fill = ci_col,
  refline_col = get_oxford_colour("red"),
  vertline_col = get_oxford_colour("ash"),
  summary_col = get_oxford_colour("ash"),
  summary_fill = summary_col,
  footnote_cex = 0.7,
  footnote_fontface = "plain",
  footnote_col = get_oxford_colour("royal"),
  title_col = get_oxford_colour("Oxford blue"),
  title_fontfamily = base_family,
  arrow_fill = get_oxford_colour("Oxford blue"),
  arrow_col = arrow_fill
)

theme_heritage_forest(
  base_size = 11,
  base_family = "Roboto",
  bg_col = get_oxford_colour("sage"),
  ci_col = get_oxford_colour("Oxford blue"),
  ci_fill = ci_col,
  refline_col = get_oxford_colour("sienna"),
  vertline_col = get_oxford_colour("peach"),
  summary_col = get_oxford_colour("green"),
  summary_fill = summary_col,
  footnote_cex = 0.8,
  footnote_fontface = "plain",
  footnote_col = get_oxford_colour("green"),
  title_col = get_oxford_colour("Oxford blue"),
  title_fontfamily = "Marcellus",
  arrow_fill = get_oxford_colour("Oxford blue"),
  arrow_col = arrow_fill
)

theme_contemporary_forest(
  base_size = 10.5,
  base_family = "Roboto",
  bg_col = get_oxford_colour("cool"),
  ci_col = get_oxford_colour("Oxford blue"),
  ci_fill = ci_col,
  refline_col = get_oxford_colour("coral"),
  vertline_col = get_oxford_colour("potters"),
  summary_col = get_oxford_colour("aqua"),
  summary_fill = summary_col,
  footnote_cex = 0.7,
  footnote_fontface = "plain",
  footnote_col = get_oxford_colour("aqua"),
  title_col = get_oxford_colour("Oxford blue"),
  title_fontfamily = "Montserrat",
  arrow_fill = get_oxford_colour("Oxford blue"),
  arrow_col = arrow_fill
)

theme_celebratory_forest(
  base_size = 10.5,
  base_family = "Roboto",
  bg_col = get_oxford_colour("lavender"),
  ci_col = get_oxford_colour("Oxford blue"),
  ci_fill = ci_col,
  refline_col = get_oxford_colour("plum"),
  vertline_col = get_oxford_colour("mauve"),
  summary_col = get_oxford_colour("viridian"),
  summary_fill = summary_col,
  footnote_cex = 0.7,
  footnote_fontface = "plain",
  footnote_col = get_oxford_colour("viridian"),
  title_col = get_oxford_colour("Oxford blue"),
  title_fontfamily = "Noto Serif Display",
  arrow_fill = get_oxford_colour("Oxford blue"),
  arrow_col = arrow_fill
)

theme_corporate_forest(
  base_size = 10.5,
  base_family = "Roboto",
  bg_col = get_oxford_colour("sky"),
  ci_col = get_oxford_colour("Oxford blue"),
  ci_fill = ci_col,
  refline_col = get_oxford_colour("orange"),
  vertline_col = get_oxford_colour("sky"),
  summary_col = get_oxford_colour("royal"),
  summary_fill = summary_col,
  footnote_cex = 0.7,
  footnote_fontface = "plain",
  footnote_col = get_oxford_colour("royal"),
  title_col = get_oxford_colour("Oxford blue"),
  title_fontfamily = "Bebas Neue",
  arrow_fill = get_oxford_colour("Oxford blue"),
  arrow_col = arrow_fill
)

theme_innovative_forest(
  base_size = 10.5,
  base_family = "Roboto",
  bg_col = get_oxford_colour("lavender"),
  ci_col = get_oxford_colour("Oxford blue"),
  ci_fill = ci_col,
  refline_col = get_oxford_colour("Oxford pink"),
  vertline_col = get_oxford_colour("vivid"),
  summary_col = get_oxford_colour("viridian"),
  summary_fill = summary_col,
  footnote_cex = 0.7,
  footnote_fontface = "plain",
  footnote_col = get_oxford_colour("viridian"),
  title_col = get_oxford_colour("Oxford blue"),
  title_fontfamily = "Phudu",
  arrow_fill = get_oxford_colour("Oxford blue"),
  arrow_col = arrow_fill
)

Arguments

base_size

The size of text

base_family

The font family to use for the text. Default to main Oxford font Roboto

bg_col

Background colour for alternating rows. Default to Oxford cool grey.

ci_col

Colour of the CI. A vector of colour should be provided for the grouped forest plot. Default set to Oxford blue

ci_fill

Colour fill the point estimation. A vector of colour should be provided for the grouped forest plot. Default to value of ci_col.

refline_col

Line colour for the reference line. Default set to Oxford red.

vertline_col

Line colour for the extra vertical line. Default set to Oxford ash grey.

summary_col

Colour for borders of the summary diamond shape. Default set to Oxford ash grey

summary_fill

Colour for filling the summary diamond shape. Default set to value of summary_col.

footnote_cex

Multiplier applied to font size for footnote.

footnote_fontface

The font face for footnote. Default to plain.

footnote_col

Colour of the footnote. Default set to Oxford royal blue.

title_col

Colour of title. Default set to Oxford blue

title_fontfamily

Font family of title. Default set to value of base_family.

arrow_fill

Filling colour of the arrow head. Default set to Oxford blue.

arrow_col

Line and text colour of the arrow. Default set to value of arrow_fill.

Value

A list of specified theme parameters.

Author(s)

Ernest Guevarra and Greco Malijan

Examples

theme_oxford_forest()