View source: R/utility_functions.R
value2col | R Documentation |
Converts ranges of values to corresponding color along color gradient, specified by 3 colors (low color, middle color and high color)
value2col(
values,
limit = NULL,
gradient.length = 100,
low.col = "skyblue",
mid.col = "grey",
high.col = "tomato"
)
limit |
numeric specifying limit of color range. If unspecified, limit <- max(c(abs(min(Values)), abs(max(Values)))) |
gradient.length |
Numeric specifying number of bins to split gradient into. Default is 100. |
low.col |
Color representing low values. Default is "skyblue" |
mid.col |
Color representing mid values. Default is "grey" |
high.col |
Color representing high values. Default is "tomato" |
Values |
vector of numerical values to convert to colors |
vector of colors.
colorRampPalette
# get edge colors
col.lim <- max(c(abs(min(vis.links$value)), abs(max(vis.links$value))))
edge.colors <- value2col(vis.links$value, limit = col.lim)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.