scores2colours: Translate values into colours

Description Usage Arguments Value Examples

View source: R/helpers.R

Description

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

Usage

1
2
3
4
5
6
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

1
2

b2slab/diffusion documentation built on March 6, 2021, 2:38 a.m.