as_grob: Convert a base plot or a ggplot2 plot into a grob

Description Usage Arguments Examples

View source: R/plot_grid.R

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.

Usage

1

Arguments

plot

The plot to convert

device

A function that creates an appropriate null device. See ['set_null_device()'] for details. If set to 'NULL', will use the cowplot-wide default.

Examples

1
2
3
4
5
6
7
library(grid)
x <- 1:10
y <- (1:10)^2

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

Alik-V/heor documentation built on April 4, 2020, 9:38 p.m.