## S3 method for class 'numeric': rescale(x, to = c(0, 1), from = range(x, na.rm = TRUE))
## S3 method for class 'ggplot': rescale(x, xlim, ylim, sx = 1, sy = 1) ## S3 method for class 'gg': rescale(x, xlim, ylim, sx = 1, sy = 1)
xis numeric value, it's just call scales::rescale, please refer to the manual page to check more details. If
xis ggplot object, it first try to estimate current x limits and y limits of the ggplot object, then rescale based on those information.
library(ggbio) head(mtcars) range(mtcars$mpg) p <- qplot(data = mtcars, x = mpg, y = disp, geom = "point") p.new <- rescale(p, xlim = c(20, 25)) p.new