plotClusterTreeSamples: Annotated clustering dendrogram of microarray samples

View source: R/Functions.R

plotClusterTreeSamplesR Documentation

Annotated clustering dendrogram of microarray samples


This function plots an annotated clustering dendorgram of microarray samples.


  y = NULL, 
  traitLabels = NULL, 
  yLabels = NULL,
  main = if (is.null(y)) "Sample dendrogram" else 
                         "Sample dendrogram and trait indicator", 
  setLayout = TRUE, autoColorHeight = TRUE, colorHeight = 0.3,
  dendroLabels = NULL, 
  addGuide = FALSE, guideAll = TRUE, 
  guideCount = NULL, guideHang = 0.2, 
  cex.traitLabels = 0.8, 
  cex.dendroLabels = 0.9, 
  marAll = c(1, 5, 3, 1), 
  saveMar = TRUE, 
  abHeight = NULL, abCol = "red", 



a data frame containing expression data, with rows corresponding to samples and columns to genes. Missing values are allowed and will be ignored.


microarray sample trait. Either a vector with one entry per sample, or a matrix in which each column corresponds to a (different) trait and each row to a sample.


labels to be printed next to the color rows depicting sample traits. Defaults to column names of y.


Optional labels to identify colors in the row identifying the sample classes. If given, must be of the same dimensions as y. Each label that occurs will be displayed once.


title for the plot.


logical: should the plotting device be partitioned into a standard layout? If FALSE, the user is responsible for partitioning. The function expects two regions of the same width, the first one immediately above the second one.


logical: should the height of the color area below the dendrogram be automatically adjusted for the number of traits? Only effective if setLayout is TRUE.


Specifies the height of the color area under dendrogram as a fraction of the height of the dendrogram area. Only effective when autoColorHeight above is FALSE.


dendrogram labels. Set to FALSE to disable dendrogram labels altogether; set to NULL to use row labels of datExpr.


logical: should vertical "guide lines" be added to the dendrogram plot? The lines make it easier to identify color codes with individual samples.


logical: add a guide line for every sample? Only effective for addGuide set TRUE.


number of guide lines to be plotted. Only effective when addGuide is TRUE and guideAll is FALSE.


fraction of the dendrogram height to leave between the top end of the guide line and the dendrogram merge height. If the guide lines overlap with dendrogram labels, increase guideHang to leave more space for the labels.


character expansion factor for trait labels.


character expansion factor for dendrogram (sample) labels.


a 4-element vector giving the bottom, left, top and right margins around the combined plot. Note that this is not the same as setting the margins via a call to par, because the bottom margin of the dendrogram and the top margin of the color underneath are always zero.


logical: save margins setting before starting the plot and restore on exit?


optional specification of the height for a horizontal line in the dendrogram, see abline.


color for plotting the horizontal line.


other graphical parameters to plot.hclust.


The function generates an average linkage hierarchical clustering dendrogram (see hclust) of samples from the given expression data, using Eclidean distance of samples. The dendrogram is plotted together with color annotation for the samples.

The trait y must be numeric. If y is integer, the colors will correspond to values. If y is continouos, it will be dichotomized to two classes, below and above median.




Steve Horvath and Peter Langfelder

See Also

dist, hclust, plotDendroAndColors

WGCNA documentation built on Jan. 22, 2023, 1:34 a.m.