add_2plots: Add two plots into a document object

View source: R/add_2plots.R

add_2plotsR Documentation

Add two plots into a document object

Description

Add two plots into a document object

Usage

add_2plots(
  mydoc,
  plotstring1,
  plotstring2,
  plottype = "auto",
  width = NULL,
  height = NULL,
  echo = FALSE,
  top = 2
)

Arguments

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

Value

a document object

Examples

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)

cardiomoon/rrtable documentation built on March 14, 2023, 10:39 p.m.