create_fullslide.RdTakes a ggplot2 object and formats it to look like a Grattan Powerpoint slide. The function adds a grey header box containing the chart title and Grattan logo, along with subtitle and caption text. Title text is automatically wrapped if longer than one line. You will rarely need to call this function directly - use `grattan_save()` to save a ggplot2 object as a 'slide'-like image.
create_fullslide(plot = last_plot(), type, font = c("slide", "normal"))A ggplot2 plot
Optional. If specified, must be one of "fullslide", "fullslide_narrow", or "fullslide_half". This determines the chart width and positioning within the slide.
Either "slide" (default) or "normal". "slide" uses DM Serif Display for the title and Avenir Next for body text (if available). "normal" uses Arial.
An object of class "patchwork" with full slide dimensions (16:9 PowerPoint slide).
The function allows for three types with different layouts:
fullslide: Standard width chart with left-aligned text/logo
fullslide_narrow: Narrower centered chart with text/logo aligned consistently with fullslide
fullslide_half: Half-width left-aligned chart for side-by-side layouts
library(ggplot2)
p <- ggplot(mtcars, aes(x = wt, y = mpg)) +
geom_point() +
labs(title = "My title",
subtitle = "My subtitle",
caption = "My caption") +
theme_grattan()
# Create an image that includes the Grattan logo
p_logo <- create_fullslide(p)