labels2colors {moduleColor} | R Documentation |
Convert numerical labels to colors.
Description
Converts a vector or array of numerical labels into a corresponding vector or array of colors corresponding to the labels.
Usage
labels2colors(labels, zeroIsGrey = TRUE, colorSeq = NULL)
Arguments
labels |
Vector of non-negative integer labels. |
zeroIsGrey |
If TRUE, labels 0 will be assigned color grey. Otherwise, labels below 1 will trigger an error. |
colorSeq |
Color sequence corresponding to labels. If not given, a standard sequence will be used. |
Details
The standard sequence start with well-distinguishable colors, and after about 40 turns into a quasi-random sampling of all colors available in R with the exception of all shades of grey (and gray).
If the input labels
have a dimension attribute, it is copied into the output, meaning the
dimensions of the returned value are the same as those of the input labels
.
Value
A vector or array of character strings of the same length or dimensions as labels
.
Author(s)
Peter Langfelder, Peter.Langfelder@gmail.com
Examples
labels = c(0:20);
labels2colors(labels);