Convert numerical labels to colors.
Converts a vector or array of numerical labels into a corresponding vector or array of colors corresponding to the labels.
labels2colors(labels, zeroIsGrey = TRUE, colorSeq = NULL)
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. |
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
.
A vector or array of character strings of the same length or dimensions as labels
.
Peter Langfelder, Peter.Langfelder@gmail.com
labels = c(0:20); labels2colors(labels);
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.