getColorFun: getColorFun

View source: R/heatmaps.R

getColorFunR Documentation

getColorFun

Description

Retrieve a color function mapping values to colors. Uses and modeled after circlize::colorRamp2.

Usage

getColorFun(x, colPal = NULL)

Arguments

x

vector or matrix including potential values

colPal

a color palette to be used. Should be a character vector specifying colors. can be named if specific colors should be used for specific values

Value

a function mapping a value to a corresponding color character string

Author(s)

Fabian Mueller

Examples

randomLetters <- sample(letters[1:6], 50, replace=TRUE)
cf_cat <- getColorFun(randomLetters)
cf_cat("f")
cf_cat("x") # NA
cf_cat2 <- getColorFun(randomLetters, colPal=c(a="#009FE3", b="#DE7E00", c="#8EC041", d="#FFCC00", e="#951B81", f="#BE1716"))
cf_num <- getColorFun(runif(50))
cf_num2 <- getColorFun(runif(50), colpal.cont(9, "cb.YlOrRd")))
cf_num2(0.5)

demuellae/muRtools documentation built on Nov. 6, 2024, 9:44 a.m.