This function plots a hierarchical clustering dendrogram and color annotation(s) of objects in the dendrogram underneath.
plotDendroAndColors(
dendro,
colors,
groupLabels = NULL,
rowText = NULL,
rowTextAlignment = c("left", "center", "right"),
rowTextIgnore = NULL,
textPositions = NULL,
setLayout = TRUE,
autoColorHeight = TRUE,
colorHeight = 0.2,
colorHeightBase = 0.2,
colorHeightMax = 0.6,
rowWidths = NULL,
dendroLabels = NULL,
addGuide = FALSE, guideAll = FALSE,
guideCount = 50, guideHang = 0.2,
addTextGuide = FALSE,
cex.colorLabels = 0.8, cex.dendroLabels = 0.9,
cex.rowText = 0.8,
marAll = c(1, 5, 3, 1), saveMar = TRUE,
abHeight = NULL, abCol = "red", ...)
a hierarchical clustering dendrogram such as one produced by
hclust
.
Coloring of objects on the dendrogram. Either a vector (one color per object) or a matrix (can also be an array or a data frame) with each column giving one color per object. Each column will be plotted as a horizontal row of colors under the dendrogram.
Labels for the colorings given in colors
. The labels will be printed to the
left of the color rows in the plot. If the argument is given, it must be a vector of length
equal to the number of columns in colors
. If not given, names(colors)
will be used if available. If not, sequential numbers starting from 1 will be used.
Optional labels to identify colors in the color rows.
If given, must be either the same dimensions as colors
or must have the same number of rows and
textPositions
must be used to specify which columns of colors
each column of rowText
corresponds to. Each label that occurs will be displayed
once, under the largest continuous block of the corresponding colors
.
Character string specifying whether the labels should be left-justified to the start of the largest block of each label, centered in the middle, or right-justified to the end of the largest block.
Optional specifications of labels that should be ignored when displaying them using
rowText
above.
optional numeric vector of the same length as the number of columns in rowText
giving the color rows under which the text rows should appear.
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
.
when autoColorHeight
is TRUE
, this specifies the minimum height of the color
area (the height when there is one color row).
when autoColorHeight
is TRUE
, this specifies the maximum height of the color
area (the height when there are many color rows).
optional specification of relative row widths for the color and text (if given) rows. Need not sum to 1.
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.
logical: should guide lines be added for the text rows (if given)?
character expansion factor for trait labels.
character expansion factor for dendrogram (sample) labels.
character expansion factor for text rows (if given).
a vector of length 4 giving the bottom, left, top and right margins of the combined plot. There is no margin between the dendrogram and the color plot underneath.
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
.
None.
The function slits the plotting device into two regions, plots the given dendrogram in the upper region, then plots color rows in the region below the dendrogram.