grattan_save_pptx: Save a ggplot2 chart, or list of charts, as a Powerpoint...

View source: R/grattan_save_pptx.R

grattan_save_pptxR Documentation

Save a ggplot2 chart, or list of charts, as a Powerpoint presentation

Description

'grattan_save_pptx()' creates a Grattan-style Powerpoint presentation with editable vector graphics and editable text. The title, subtitle, and caption of your graph are placed in the appropriate places. Speaker notes are included, which include the file path to the R script from which you called 'grattan_save_pptx()'. If you supply a list of plots, your Powerpoint presentation will include multiple slides – one per plot. If you specify multiple types, multiple PPTX files will be created. This function is usually best called by running 'grattan_save(..., save_pptx = T)' or 'grattan_save_all()', rather than calling it directly.

Usage

grattan_save_pptx(
  filename,
  p = ggplot2::last_plot(),
  type = "fullslide",
  rich_subtitle = FALSE,
  png_dpi = 300
)

Arguments

filename

Filename (including path where necessary) to save your Powerpoint presentation.

p

ggplot2 plot, or a list of ggplot2 plots

type

Chart type. If you specify multiple types, as in 'type = c("fullslide", "wholecolumn")' or 'type = "all"', multiple files will be created, with the type added to the filename.

rich_subtitle

Logical. If 'TRUE', the plot will be saved as a high-quality PNG image and inserted into the slide. This is mainly intended for folks using a lot of markdown text in the subtitles and plots.

png_dpi

Integer. The DPI of the PNG image saved when 'rich_subtitle = TRUE'.

Examples

## Not run: 
library(ggplot2)

p <- ggplot(mtcars, aes(x = wt, y = mpg)) +
       geom_point() +
       theme_grattan() +
       labs(title = "My title",
            subtitle = "My subtitle",
            caption = "Notes: notes go here. Source: source goes here.")

grattan_save_pptx(p, "test.pptx")

library(ggplot2)


## End(Not run)

grattan/grattantheme documentation built on April 11, 2025, 8:56 p.m.