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"
)

Arguments

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

Value

vector of colors.

See also

Examples


# get edge colors
col.lim <- max(c(abs(min(vis.links$value)), abs(max(vis.links$value))))
#> Error in eval(expr, envir, enclos): object 'vis.links' not found
edge.colors <- value2col(vis.links$value, limit = col.lim)
#> Error in value2col(vis.links$value, limit = col.lim): could not find function "value2col"