Learn R Programming

WGCNA (version 1.27-1)

numbers2colors: Color representation for a numeric variable

Description

The function creates a color represenation for the given numeric input.

Usage

numbers2colors(
   x, 
   signed = NULL, 
   centered = signed, 
   lim = NULL, 
   commonLim = FALSE,
   colors = if (signed) blueWhiteRed(100) else blueWhiteRed(100)[51:100],
   naColor = "grey")

Arguments

x
a vector or matrix of numbers. Missing values are allowed and will be assigned the color given in naColor. If a matrix, each column of the matrix is processed separately and the return value will be a matrix of colors.
signed
logical: should x be considered signed? If TRUE, the default setting is to use to use a palette that starts with green for the most negative values, continues with white for values around zero and turns red for positive values. I
centered
logical. If TRUE and signed==TRUE, numeric value zero will correspond to the middle of the color palette. If FALSE or signed==FALSE, the middle of the color palette will correspond to the average of the
lim
optional specification of limits, that is numeric values that should correspond to the first and last entry of colors.
commonLim
logical: should limits be calculated separately for each column of x, or should the limits be the same for all columns? Only applies if lim is NULL.
colors
color palette to represent the given numbers.
naColor
color to represent missing values in x.

Value

  • A vector or matrix (of the same dimensions as x) of colors.

Details

Each column of x is processed individually, meaning that the color palette is adjusted individually for each column of x.

See Also

labels2colors for color coding of ordinal labels.