This is a shortcut for supplying the
limits argument to the
individual scales. Note that, by default, any values outside the limits
will be replaced with
lims(...) xlim(...) ylim(...)
A name-value pair. The name must be an aesthetic, and the value must be either a length-2 numeric, a character, a factor, or a date/time.
A numeric value will create a continuous scale. If the larger value
comes first, the scale will be reversed. You can leave one value as
NA to compute from the range of the data.
A character or factor value will create a discrete scale.
A date-time value will create a continuous date/time scale.
#> Warning: Removed 19 rows containing missing values (geom_point).#> Warning: Removed 19 rows containing missing values (geom_point).#> Warning: Removed 14 rows containing missing values (geom_point).# You can also supply limits that are larger than the data. # This is useful if you want to match scales across different plots small <- subset(mtcars, cyl == 4) big <- subset(mtcars, cyl > 4) ggplot(small, aes(mpg, wt, colour = factor(cyl))) + geom_point() + lims(colour = c("4", "6", "8"))