View source: R/colorGradient.R
colorGradient | R Documentation |
Generate a gradient of hexadecimal colors from a numeric vector
colorGradient(x, colors = heat.colors(10), colsteps = 100, na.rm = TRUE, ...)
x |
numeric vector |
colors |
values recognizable by R as colors - text, hexadecimal, numbers, etc. (default = |
colsteps |
numeric value, number of unique colors to include in gradient |
na.rm |
logical value (default = |
... |
additional arguments passed to |
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
).
character vector
optimFPM, heat.colors, colorRamp
x <- rnorm(n = 100)
cols <- colorGradient(x, c("red", "white", "blue"))
plot(x, col = cols)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.