as.colors: Convert labels to colors

Description Usage Arguments Value Author(s) Examples

View source: R/utils.R

Description

This function returns a object a colors values according to a palette function

Usage

1
as.colors(x, col.na="#E6E6E6",palette="rainbow", ...)

Arguments

x

A object (vector or matrix) to convert in colors.

col.na

Colors to use for missing values.

palette

The palette function to use

...

Additional argument for the palette function. The 'n' parameters must exist in the palette function

Value

A vector or matrix of color label.

Author(s)

Nicolas Servant, Eleonore Gravier, Pierre Gestraud, Cecile Laurent, Caroline Paccard, Anne Biton, Jonas Mandel, Bernard Asselain, Emmanuel Barillot, Philippe Hupe

Examples

1
2
3
4
5
     lab1<-c(rep("a",5), rep("b",5))
     lab2<-c(rep("c",5), rep("a",5))
     as.colors(lab1)
     as.colors(rbind(lab1, lab2))
     as.colors(lab2, palette="heat.colors", alpha=0.8)

EMA documentation built on March 26, 2020, 8:40 p.m.