A shorthand for scale_x_continuous(limits = ). Data outside the limits is still computed by stats but clipped to the panel when drawn.

xlim(...)

ylim(...)

Arguments

...

Two numbers giving the lower and upper limit, or one length-2 numeric vector.

Value

A scale object to add to a plot with +.

Examples

ggnext(cars, aes(speed, dist)) + geom_point() + xlim(0, 30) + ylim(0, 150)
#> <ggnext plot>
#>   data:  50 x 2
#>   aes:   x = speed, y = dist
#>   layers: 1 
#>   coord: cartesian
#>   mode:  static