File: get_panel.Rd

package info (click to toggle)
r-cran-cowplot 1.1.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,564 kB
  • sloc: sh: 13; makefile: 5
file content (40 lines) | stat: -rw-r--r-- 1,130 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
30
31
32
33
34
35
36
37
38
39
40
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/get_panel.R
\name{get_panel}
\alias{get_panel}
\alias{get_panel_component}
\title{Retrieve the panel or part of a panel of a plot}
\usage{
get_panel(plot, panel = NULL, return_all = FALSE)

get_panel_component(panel, pattern)
}
\arguments{
\item{plot}{A ggplot or gtable from which to retrieve the panel}

\item{panel}{An integer indicating which panel to pull. ggplot orders panels
column-wise, so this is in order from the top left down.}

\item{return_all}{If there is more than one panel, should all be returned
as a list? Default is \code{FALSE}.}

\item{pattern}{the name of the component}
}
\value{
A gtable object holding the panel(s) or a grob of the component
}
\description{
\code{get_panel()} extracts just the main panel from a ggplot or a specified panel
in a faceted plot. \code{get_panel_component()} extracts components from the
panel, such as geoms.
}
\examples{
library(ggplot2)

p <- ggplot(mpg, aes(displ, cty)) + geom_point()
plot_panel <- get_panel(p)
ggdraw(plot_panel)

ggdraw(get_panel_component(plot_panel, "geom_point"))

}