R/pal-rescale.r

Defines functions rescale_pal

Documented in rescale_pal

#' Rescale palette (continuous)
#'
#' Just rescales the input to the specific output range.  Useful for
#' alpha, size, and continuous position.
#'
#' @param range Numeric vector of length two, giving range of possible
#'   values.  Should be between 0 and 1.
#' @export
rescale_pal <- function(range = c(0.1, 1)) {
  force(range)
  function(x) {
    rescale(x, range, c(0, 1))
  }
}

Try the scales package in your browser

Any scripts or data that you put into this service are public.

scales documentation built on Aug. 20, 2022, 1:05 a.m.