add_2ggplots: Add two ggplots into a document object

View source: R/add_2ggplots.R

add_2ggplotsR Documentation

Add two ggplots into a document object

Description

Add two ggplots into a document object

Usage

add_2ggplots(mydoc, plot1, plot2, width = 3, height = 2.5, top = 2)

Arguments

mydoc

A document object

plot1

An R code encoding the first ggplot

plot2

An R code encoding the second ggplot

width

plot width in inches

height

plot height in inches

top

top plot position in inches

Value

a document object

Examples

## Not run: 
require(ggplot2)
require(magrittr)
require(officer)
require(rvg)
plot1 <- "ggplot(data = iris, aes(Sepal.Length, Petal.Length)) + geom_point()"
plot2 <- "ggplot(data = iris, aes(Sepal.Length, Petal.Length, color = Species)) + geom_point()"
read_pptx() %>% add_text(title="Two ggplots") %>% add_2ggplots(plot1=plot1,plot2=plot2)
read_docx() %>% add_text(title="Two ggplots") %>% add_2ggplots(plot1=plot1,plot2=plot2)

## End(Not run)

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