File: get_y_axis.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 (32 lines) | stat: -rw-r--r-- 817 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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/get_axes.R
\name{get_y_axis}
\alias{get_y_axis}
\alias{get_x_axis}
\title{Get plot axes}
\usage{
get_y_axis(plot, position = c("left", "right"))

get_x_axis(plot, position = c("bottom", "top"))
}
\arguments{
\item{plot}{A ggplot or gtable.}

\item{position}{Which side of the plot is the axis on? For the x-axis, this
can be "top" or "bottom", and for the y-axis, it can be "left" or "right".}
}
\description{
These functions extract just the axes from a ggplot. \code{get_y_axis()} pulls
the y-axis, while \code{get_x_axis()} pulls the x-axis.
}
\examples{
library(ggplot2)

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

ggdraw(get_y_axis(p))
p <- p + scale_x_continuous(position = "top")
ggdraw(get_x_axis(p, position = "top"))

}