forked from tidyverse/ggplot2
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathexpand_limits.Rd
30 lines (29 loc) · 940 Bytes
/
expand_limits.Rd
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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/limits.r
\name{expand_limits}
\alias{expand_limits}
\title{Expand the plot limits, using data}
\usage{
expand_limits(...)
}
\arguments{
\item{...}{named list of aesthetics specifying the value (or values) that
should be included in each scale.}
}
\description{
Sometimes you may want to ensure limits include a single value, for all
panels or all plots. This function is a thin wrapper around
\code{\link[=geom_blank]{geom_blank()}} that makes it easy to add such values.
}
\examples{
p <- ggplot(mtcars, aes(mpg, wt)) + geom_point()
p + expand_limits(x = 0)
p + expand_limits(y = c(1, 9))
p + expand_limits(x = 0, y = 0)
ggplot(mtcars, aes(mpg, wt)) +
geom_point(aes(colour = cyl)) +
expand_limits(colour = seq(2, 10, by = 2))
ggplot(mtcars, aes(mpg, wt)) +
geom_point(aes(colour = factor(cyl))) +
expand_limits(colour = factor(seq(2, 10, by = 2)))
}