colorGradient {RFPM}R Documentation

Color Gradient Generator

Description

Generate a gradient of hexadecimal colors from a numeric vector

Usage

colorGradient(x, colors = heat.colors(10), colsteps = 100, na.rm = TRUE, ...)

Arguments

x

numeric vector

colors

values recognizable by R as colors - text, hexadecimal, numbers, etc. (default = grDevices::heat.colors(10)).

colsteps

numeric value, number of unique colors to include in gradient

na.rm

logical value (default = TRUE) indicating whether to exclude NA values in x

...

additional arguments passed to grDevices::colorRamp

Details

colorGradient generates a color gradient based on a numeric input x. The original version (named 'color.gradient') was written by David Hoop in a 2016 stack.overflow response to question (online). The function was modified slightly for adaptability of inputs. Note that the full color gradient is used if possible, which can exaggerate small differences in x. This function is applied by optimFPM when generating color-based optimization matrix graphics (i.e., when optimizing both alpha and FN_crit).

Value

character vector

See Also

optimFPM, heat.colors, colorRamp

Examples

x <- rnorm(n = 100)
cols <- colorGradient(x, c("red", "white", "blue"))
plot(x, col = cols)

[Package RFPM version 1.1 Index]