dml | R Documentation |
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,
...
)
code |
plotting instructions |
ggobj |
ggplot object to print. argument code will be ignored if this argument is supplied. |
bg , fonts , pointsize , editable |
Parameters passed to |
... |
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:
theme( panel.background = element_rect(fill = "#EFEFEF"), plot.background = element_rect(fill = "wheat"))
ph_with.dml
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.