File: as_ggplot.Rd

package info (click to toggle)
r-cran-ggpubr 0.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 3,240 kB
  • sloc: makefile: 2
file content (37 lines) | stat: -rw-r--r-- 966 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/as_ggplot.R
\name{as_ggplot}
\alias{as_ggplot}
\title{Storing grid.arrange() arrangeGrob() and plots}
\usage{
as_ggplot(x)
}
\arguments{
\item{x}{an object of class gtable or grob as returned by the functions
\code{\link[gridExtra:arrangeGrob]{arrangeGrob}()} and
\code{\link[gridExtra:arrangeGrob]{grid.arrange}()}.}
}
\value{
an object of class ggplot.
}
\description{
Transform the output of
 \code{\link[gridExtra:arrangeGrob]{arrangeGrob}()} and
 \code{\link[gridExtra:arrangeGrob]{grid.arrange}()} to a an object of class
 ggplot.
}
\examples{
# 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)

}