File: as_grob.Rd

package info (click to toggle)
r-cran-cowplot 1.1.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,564 kB
  • sloc: sh: 13; makefile: 5
file content (29 lines) | stat: -rw-r--r-- 897 bytes parent folder | download | duplicates (2)
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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/as_grob.R
\name{as_grob}
\alias{as_grob}
\title{Convert a base plot or a ggplot2 plot into a grob}
\usage{
as_grob(plot, device = NULL)
}
\arguments{
\item{plot}{The plot to convert}

\item{device}{A function that creates an appropriate null device. See \code{\link[=set_null_device]{set_null_device()}}
for details. If set to \code{NULL}, will use the cowplot-wide default.}
}
\description{
This function does its best attempt to take whatever you provide it and turn it into a grob.
It is primarily meant to convert ggplot plots into grobs, but it will also take any grid
object (grob), a recorded base R plot, a formula specifying a base R plot, a function that
generates a base R plot, or a trellis object.
}
\examples{
library(grid)
x <- 1:10
y <- (1:10)^2

p <- ~plot(x, y)
grid.newpage()
grid.draw(as_grob(p))
}