value2col: Convert values to color gradient

View source: R/utility_functions.R

value2colR Documentation

Convert values to color gradient

Description

Converts ranges of values to corresponding color along color gradient, specified by 3 colors (low color, middle color and high color)

Usage

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

colorRampPalette

Examples


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


NMikolajewicz/scMiko documentation built on June 28, 2023, 1:41 p.m.