values2colors: Convert a vector of numeric values to a vector of colors

View source: R/values2colors.R

values2colorsR Documentation

Convert a vector of numeric values to a vector of colors

Description

Convert a vector of numeric values to a vector of color names. The input vector is divided into a number of intervals, set by breaks. Values in each interval are assigned a color along a scale generated by colorRampPalette.

Usage

values2colors(x,
  col.start = "blue", col.end = "red",
  col.pal = NULL, na.col = "grey50",
  breaks = 10)

Arguments

x

numeric vector containing values to be converted to colors

col.start, col.end

color names indicating the start and end of the color ramp. Passed to colorRampPalette.

col.pal

name of a palette from RColorBrewer; an alternative way to specify color palette. The specified palette will be passed to colorRampPalette.

na.col

color name to use for NA values in x. Defaults to "grey50".

breaks

number of intervals to break the values of x into. Defaults to 10.

Value

a vector of color names, of length equivalent to the length of x.


mjdufort/miscHelpers documentation built on July 29, 2024, 6:14 p.m.