scores2colours {diffuStats}R Documentation

Translate values into colours

Description

Create a vector of hex colours from numeric values, typically diffusion scores

Usage

scores2colours(
    x,
    range = c(min(0, min(x)), max(x)),
    n.colors = 10,
    palette = colorRampPalette(c("#3C5488FF", "white", "#F39B7FFF"))
)

Arguments

x

numeric vector to be colorised

range

range of values to filter x (values out of the range will be collapsed to the closest limit)

n.colors

integer, number of colors in the palette

palette

palette function that generates a scale of colours given the number of desired colours. Defaults to a blue-white-red scale by colorRampPalette

Value

Character vector with hex colours

Examples

set.seed(1)
scores2colours(runif(20))


[Package diffuStats version 1.12.0 Index]