AAGI

December 11, 2024

if (!require("pak")) install.packages("pak")

if (!require("AAGIPalettes")) {
  pak::pkg_install("AAGI-AUS/AAGIPalettes")
}

if (!require("AAGIThemes")) {
  pak::pkg_install("AAGI-AUS/AAGIThemes")
}

if (!require("gapminder")) {
  pak::pkg_install("gapminder")
}

library(ggplot2)
library(AAGIThemes)

# set ggplot2 theme
theme_set(theme_aagi())

An AAGI Reveal.js Theme for Quarto

This Quarto extension allows you to create your slides using a theme that follows AAGI typography and colour styles and provides the official AAGI logo and cover image for the title slide.

Basic Tables

AAGIQuarto provides basic theming of HTML tables through CSS, for example, this is a markdown table.

| Syntax      | Description |
| ----------- | ----------- |
| Header      | Title       |
| Paragraph   | Text        |

That renders like this.

Syntax Description
Header Title
Paragraph Text

Advanced Tables

For more advanced tables, we suggest pairing with the R package {AAGIThemes} to provide AAGI themed tables using theme_gt_aagi(), that offers more flexibility in formatting.

library(dplyr)
library(gt)
library(AAGIThemes)

gt <- gt(head(airquality) |>
 mutate(`Month Name` = "May"))
gt <- theme_gt_aagi(gt)
gt
Ozone Solar.R Wind Temp Month Day Month Name
41 190 7.4 67 5 1 May
36 118 8.0 72 5 2 May
12 149 12.6 74 5 3 May
18 313 11.5 62 5 4 May
NA NA 14.3 56 5 5 May
28 NA 14.9 66 5 6 May

Basic Figures

{AAGIThemes} also provides support for theming basic figures in R, for example.

library(AAGIThemes)
plot_aagi(pressure)

Figures with {ggplot2}

{AAGIThemes} also provides support for theming {ggplot2} outputs in R, for example.

#Prepare data

library(gapminder)
library(dplyr)
library(ggplot2)
library(AAGIThemes)

facet <- gapminder |>
  filter(continent != "Americas") |>
  group_by(continent, year) |>
  summarise(pop = sum(as.numeric(pop)))
#> `summarise()` has grouped output by 'continent'. You can override using the
#> `.groups` argument.

col_values <- c(
  AAGIPalettes::colour_as_hex("AAGI Teal"),
  AAGIPalettes::colour_as_hex("AAGI Green"),
  AAGIPalettes::colour_as_hex("AAGI Yellow"),
  AAGIPalettes::colour_as_hex("AAGI Blue")
)

#Make plot
ggplot() +
  geom_area(data = facet, aes(x = year, y = pop, fill = continent)) +
  scale_fill_manual(values = col_values) +
  facet_wrap(~ continent, ncol = 5) +
  scale_y_continuous(breaks = c(0, 2000000000, 4000000000),
                    labels = c(0, "2bn", "4bn")) +
  theme_aagi() +
  geom_hline(yintercept = 0,
            linewidth = 1,
            colour = "#474747") +
  theme(legend.position = "none", axis.text.x = element_blank()) +
  labs(title = "Asia's rapid growth", subtitle = "Population growth by continent, 1952-2007")

Slides With Columns

This is a column on the left.

This is a column on the right.

More Information

You can learn more about controlling the appearance of revealjs output here: https://quarto.org/docs/presentations/revealjs/

Thank You