add_2plots | R Documentation |
Add two plots into a document object
add_2plots( mydoc, plotstring1, plotstring2, plottype = "auto", width = NULL, height = NULL, echo = FALSE, top = 2 )
mydoc |
A document object |
plotstring1 |
An R code string encoding the first plot |
plotstring2 |
An R code string encoding the second plot |
plottype |
character One of c("auto","plot","ggplot") |
width |
plot width in inches |
height |
plot height in inches |
echo |
logical Whether or not show R code |
top |
top plot position in inches |
a document object
require(magrittr) require(officer) require(ggplot2) plotstring1="plot(iris)" plotstring2="ggplot(iris,aes(x=Sepal.Length,y=Sepal.Width))+geom_point()" read_pptx() %>% add_text(title="Two plots") %>% add_2plots(plotstring1,plotstring2) read_docx() %>% add_text(title="Two plots") %>% add_2plots(plotstring1,plotstring2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.