Learn R Programming

WGCNA (version 1.70-3)

labeledBarplot: Barplot with text or color labels.

Description

Produce a barplot with extra annotation.

Usage

labeledBarplot(
      Matrix, labels, 
      colorLabels = FALSE, 
      colored = TRUE, 
      setStdMargins = TRUE, 
      stdErrors = NULL, 
      cex.lab = NULL, 
      xLabelsAngle = 45,
      ...)

Arguments

Matrix

vector or a matrix to be plotted.

labels

labels to annotate the bars underneath the barplot.

colorLabels

logical: should the labels be interpreted as colors? If TRUE, the bars will be labeled by colored squares instead of text. See details.

colored

logical: should the bars be divided into segments and colored? If TRUE, assumes the labels can be interpreted as colors, and the input Matrix is square and the rows have the same labels as the columns. See details.

setStdMargins

if TRUE, the function wil set margins c(3, 3, 2, 2)+0.2.

stdErrors

if given, error bars corresponding to 1.96*stdErrors will be plotted on top of the bars.

cex.lab

character expansion factor for axis labels, including the text labels underneath the barplot.

xLabelsAngle

angle at which text labels under the barplot will be printed.

other parameters for the function barplot.

Value

None.

Details

Individual bars in the barplot can be identified either by printing the text of the corresponding entry in labels underneath the bar at the angle specified by xLabelsAngle, or by interpreting the labels entry as a color (see below) and drawing a correspondingly colored square underneath the bar.

For reasons of compatibility with other functions, labels are interpreted as colors after stripping the first two characters from each label. For example, the label "MEturquoise" is interpreted as the color turquoise.

If colored is set, the code assumes that labels can be interpreted as colors, and the input Matrix is square and the rows have the same labels as the columns. Each bar in the barplot is then sectioned into contributions from each row entry in Matrix and is colored by the color given by the entry in labels that corresponds to the row.