A simple wrapper to mark
the plot instructions as Vector Graphics instructions. It produces
an object of class 'dml' with a corresponding method ph_with
.
The function enable usage of any R plot with argument code
and with
ggplot objects with argument ggobj
.
dml(
code,
ggobj = NULL,
bg = "white",
fonts = list(),
pointsize = 12,
editable = TRUE,
...
)
plotting instructions
ggplot object to print. argument code will be ignored if this argument is supplied.
Parameters passed to dml_pptx
unused arguments
When dealing with a ggplot object argument bg
will have no effect
because ggplot theme is specifying background color, don't forget
to define the colors you want in the theme:
anyplot <- dml(code = barplot(1:5, col = 2:6), bg = "wheat")
library(officer)
doc <- read_pptx()
doc <- add_slide(doc, "Title and Content", "Office Theme")
doc <- ph_with(doc, anyplot, location = ph_location_fullsize())
fileout <- tempfile(fileext = ".pptx")
# fileout <- "vg.pptx"
print(doc, target = fileout)