as_ggplot: Storing grid.arrange() arrangeGrob() and plots

Description Usage Arguments Value Examples

View source: R/as_ggplot.R

Description

Transform the output of arrangeGrob() and grid.arrange() to a an object of class ggplot.

Usage

1

Arguments

x

an object of class gtable or grob as returned by the functions arrangeGrob() and grid.arrange().

Value

an object of class ggplot.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Creat some plots
bxp <- ggboxplot(iris, x = "Species", y = "Sepal.Length")
vp <- ggviolin(iris, x = "Species", y = "Sepal.Length",
              add = "mean_sd")

# Arrange the plots in one page
# Returns a gtable (grob) object
library(gridExtra)
gt <- arrangeGrob(bxp, vp, ncol = 2)

# Transform to a ggplot and print
as_ggplot(gt)

YTLogos/ggpubr documentation built on May 3, 2019, 9:04 p.m.