Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Expand the plot limits, using data

Source:R/limits.R
expand_limits.Rd

[Superseded]: It is recommended to pass a function tothelimits argument in scales instead. For example:scale_x_continuous(limits = ~range(.x, 0)) to include zero.

Sometimes you may want to ensure limits include a single value, for allpanels or all plots. This function is a thin wrapper aroundgeom_blank() that makes it easy to add such values.

Usage

expand_limits(...)

Arguments

...

named list of aesthetics specifying the value (or values) thatshould be included in each scale.

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)))

[8]ページ先頭

©2009-2025 Movatter.jp