getColsByBin: Get colors by bin.

View source: R/plotting.R

getColsByBinR Documentation

Get colors by bin.

Description

Get colors for elements according to their bin. Colors are assigned to bins forming a gradient from col1 to col2 in the order of levels{b}. col0 is assigned to the neutral bin (attribute "") if available.

Usage

getColsByBin(
  b,
  col1 = c("#003C30", "#01665E", "#35978F", "#80CDC1", "#C7EAE5"),
  col2 = c("#F6E8C3", "#DFC27D", "#BF812D", "#8C510A", "#543005"),
  col0 = "#F5F5F5"
)

Arguments

b

A factor that groups elements into bins (typically the output of bin).

col1

First color.

col2

Second color.

col0

Neutral color.

Value

A character vector with colors for the elements in b.

See Also

bin.

Examples

set.seed(1)
x <- rnorm(100)
b <- bin(x, "equalN", nElements = 10)
cols <- getColsByBin(b)


fmicompbio/monaLisa documentation built on Nov. 2, 2024, 1:33 p.m.