View source: R/djpr_save_pptx.R
djpr_save_pptx | R Documentation |
The exported slide will use the SPP template. All text is editable on the slide. Users can choose from several slide formats.
djpr_save_pptx(
destination = NULL,
plot = ggplot2::last_plot(),
layout = c("full", "half", "twothirds"),
signpost = NULL
)
destination |
The destination for the slide. Can be one of:
|
plot |
The ggplot to turn into a slide.
Default is |
layout |
Slide layout to use. Options are "full", "half", and "twothirds". The layouts refer to the proportion of the slide width taken up by the chart. |
signpost |
Signpost heading, if required. If |
For plot layouts other than 'full', you can add dot points in the
sidebar of the plot using labs(sidebar = c("Dot point 1", "Dot point 2"))
.
If destination
is NULL
or a pptx
object, returns the updated
presentation ready for further changes.
Otherwise, the return value is undefined (and may change in future) since
the function saves the slide to a file.
## Not run:
library(ggplot2)
# First, create a ggplot2 object
the_ggplot <- ggplot(mtcars, aes(x = wt, y = mpg)) +
geom_point() +
labs(
title = "Chart title",
subtitle = "Chart subtitle",
caption = "Notes and source information."
)
# Export `the_ggplot` to file `output.pptx`
djpr_save_pptx("output.pptx", the_ggplot)
# Specify layout and signpost
djpr_save_pptx("output.pptx", the_ggplot, layout = "half", signpost = "section")
# For slide layouts other than 'full', you can add text commentary in the
# sidebar of the slide, ike this:
the_ggplot_with_sidebar <- the_ggplot +
labs(sidebar = c("These are some comments", "For the sidebar of the slide"))
djpr_save_pptx("output.pptx", the_ggplot_with_sidebar, layout = "twothirds")
# Export multiple slides. Different plots can be passed in for each slide.
djpr_save_pptx(NULL, the_ggplot) %>%
djpr_save_pptx(the_ggplot, layout="half") %>%
print(target="slidepack.pptx")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.