Warwick-branded plots, presentations and websites using Quarto and R

Ella Kaye

June 10, 2024

These slides

https://warwick-stats-resources.github.io/warwickbrand-talk

All text in blue is a link

What I’d like you to take from this talk

  • These resources exist

  • What they look like

  • A quick guide to getting started using them

  • Where to learn more (they are well-documented)

Top takeway

Please use them!

What this talk is not

  • A detailed technical demonstration of their use

  • How to develop packages / write Quarto extensions

  • A guide to using Quarto

What is Quarto?

  • An open-source scientific and technical publishing system
  • Create dynamic content with Python, R, Julia, and Observable
  • Publish reproducible, production quality articles, presentations, dashboards, websites, blogs, and books in HTML, PDF, MS Word, ePub, and more.
  • Write using Pandoc markdown, including equations, citations, crossrefs, figure panels, callouts, advanced layout, and more

But first…

The University of Warwick brand

Colours

Warwick brand colours

Typography

Warwick brand typography

  • Lato for digital
  • Avenir Next for print

warwickplots

warwickplots

An R package with colour palettes and a ggplot2 theme that are consistent with The University of Warwick’s branding, especially its colours and typography.

The palettes are built using the palettes package. The ggplot2 theme is heavily inspired by the work of Cara Thompson, particularly her talk on applying a unifying aesthetic to your plots.

The palettes

library(warwickplots)
plot(warwick_palettes)

warwickplots and ggplot2

  • Colour and fill scales provided by the palettes package

scale_colour_palette_d() scale_colour_palette_c() scale_colour_palette_b()

scale_fill_palette_d() scale_fill_palette_c() scale_fill_palette_b()

  • theme_warwick()

theme_warwick()

An extension of ggplot2::theme_minimal(), offering the following in addition:

  • Text hierarchy, with different sizes and colours
  • Spacing, giving the text room to breathe
  • Uses element_textbox_simple() from ggtext for the plot title and subtitle, to enable use of markdown and CSS styling, and text-wrapping if the title/subtitle is long
  • Places the legend above the plot
  • Uses Lato or Avenir Next font (for online or print use respectively), if your system is set up for it

warwickplots example

ggplot(penguins, aes(flipper_length_mm, body_mass_g, group = species)) +
  geom_point(aes(colour = species, shape = species), 
             alpha = 0.8, 
             size = 2) +
  scale_color_palette_d(warwick_palettes$primary) +
  labs(title = "Penguin Size, Palmer Station LTER",
       subtitle = "Flipper length and body mass for 
                  **<span style = 'color:#3C1053;'>Adelie</span>**, 
                  **<span style = 'color:#6DCDB8;'>Chinstrap</span>** and 
                  **<span style = 'color:#CB333B;'>Gentoo</span>** Penguins. 
                  This is based on data made available in the 
                  **palmerpenguins** R package.",
       caption = "Visualization: Ella Kaye, Data: Gorman, Williams & Fraser (2014) DOI: 10.1371/journal.pone.009008",
       x = "flipper length (mm)",
       y = "body mass (g)") +
  theme_warwick() +
  theme(legend.position = 'none')

warwickplots example

More about warwickplots

Package website: warwick-stats-resources.github.io/warwickplots

Package repo: github.com/warwick-stats-resources/warwickplots

See also: all the documentation for the palettes package

warwickpres

A Quarto Revealjs extension

  • The University of Warwick logo on the title slide
  • A theme consistent with the University of Warwick’s brand colours, including an inverse class
  • A font (Lato) consistent with the University of Warwick’s typography guidelines
  • Colours consistent with the brand for quarto callouts
  • A custom syntax highlighting theme consistent with the brand colours
  • Additional convenience classes for sizing and aligning

Examples

This is a warwickpres!

The warwickpres starting point:

https://warwick-stats-resources.github.io/warwickpres

Let’s take a look…

Getting started

quarto use template Warwick-Stats-Resources/warwickpres

Note

The workflow for using warwickpres in an RStudio project with git/GitHub/gh-pages is a bit fiddly, but well documented in the README.

Demo

  • Setting up with an RStudio project, git, GitHub and GitHub Page
  • Exploring the template
    • YAML
    • HTML for callouts

warwickcourse

A website template

  • Consistent with The University of Warwick brand
  • Home page (index.qmd) ready to fill in key course details
  • Pages for the schedule, joining instructions and prerequisites
  • Assumes multiple sessions, each with its own content page and slide deck
    • Templates for content and slides
    • create_session()

Examples

The template:

warwick-stats-resources.github.io/warwickcourse

R package development workshop 2024:

warwick-stats-resources.github.io/r-packages-2024

Sign-up for the R package development workshop!

warwick.ac.uk/ellakaye/r-packages-2024

Deadline June 18th (Warwick members only)

create_session()

source("R/sessions.R")
create_session("session-name")
  • create slides/session-name, copying slides/00-template
  • create content/session-name, copying content/00-template
  • replace all instances of UPDATE-DIR-NAME in content/session-name/index.qmd with session-name
    • links to slides in a new window
    • embeds slides in the content page
  • delete_session()

Demo

  • Getting the template from GitHub
  • editing content and slides template
    • note YAML additions to warwickpres
  • create_session()
  • listings

Thank you!


ella.m.kaye@warwick.ac.uk

github.com/Warwick-Stats-Resources