pptfig overview and examples
Eben Pendleton and Katherine Heal
2022-08-10
pptfig.Rmd
Introduction
Welcome to an overview and examples for Integral’s PowerPoint theme, ic_ppttheme() and figure function, ic_pptfig(). The first step is to load the library.
The library has two functions, ic_ppttheme() which is a theme associated with ggplot2 and ic_pptfig() which handles placing the figures in the PowerPoint template.
ic_ppttheme()
This theme is loaded from the library in the example below You can add this to any ggplot to get a consistent theme
theme <- integral::ic_ppttheme()
ic_pptfig()
ic_pptfig() handles placing the figures in the PowerPoint template.
An example using ic_ppttheme with defaults
# library in this vignette
library(integral)
# library for graphics creation
library(ggplot2)
### Set Theme
theme <- integral::ic_ppttheme()
###Figure
p <- ggplot() +
theme
### Minimal example
my_pres <- ic_pptfig(
my_pres = NA,
fig = p,
fignum = 1,
author = "J. Doe",
doctitle1 = "An Empty Plot in a Template")
### Adding a second figure to the presentation
my_pres <- ic_pptfig(
my_pres = my_pres,
fig = p,
fignum = 1,
author = "J. Doe",
doctitle1 = "A Second Plot in a Template")
# saves out the pptx file
print(my_pres, "Output_default.pptx")
An example using non-default settings is below.
# library in this vignette
library(integral)
# library for graphics creation
library(ggplot2)
###Theme
theme <- integral::ic_ppttheme()
###Figure
p <- ggplot() +
theme
###pptfig
### landscape 11 x 8.5
my_pres <- ic_pptfig(
size = "ledger",
orientation = "L",
fig = p,
section = "D",
fignum = 1,
note = "Note: This is an empty plot.",
author = "J. Doe",
doctitle1 = "An Empty Plot",
doctitle2 = "Project Description 1",
doctitle3 = "Project Description 2",
draft = "",
pc = "",
showpath = F
)
print(my_pres, "Output_L_ledger.pptx")