R/pal-manual.r

Defines functions manual_pal

Documented in manual_pal

#' Manual palette (manual).
#'
#' @param values vector of values to be used as a palette.
#' @export
manual_pal <- function(values) {
  function(n) {
    n_values <- length(values)
    if (n > n_values) {
      warning("This manual palette can handle a maximum of ", n_values,
        " values. You have supplied ", n , ".", call. = FALSE)
    }
    values[seq_len(n)]
  }
}

Try the scales package in your browser

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

scales documentation built on Aug. 24, 2017, 5:22 p.m.