Description Usage Arguments Details Value Author(s) References See Also Examples
Displays a matrix as a heatmap, i.e. as a grid of colored rectangles with colors corresponding to the values in the matrix.
1 2 | plotHeatmap(X, margin, fast=FALSE, colorscale="green-black-red",
pch=".", cex=10)
|
X |
a numerical matrix. |
margin |
optional vector of length 2 specifying the margins around the heatmap. The first component specifies the width of the inner margin (default value is 0.05) and the second component specifies the width of the outer margin (default value is 0.4). The inner margin surrounds the heatmap on all sides, while the outer margin is only present on the left side and top side of the heatmap. See details below for explanation on how to use this parameter. |
fast |
logical value indicating whether to use a fast method or not to plot the heatmap. The fast method plots the entire heatmap with a single call to |
colorscale |
color scale used to represent the numerical values in |
pch |
plot character used to display a rectangle in the heatmap (only used if |
cex |
plot character size (only used if |
Displays a numerical matrix as an pseudo-color heatmap where rows and columns in the heatmap correspond to rows and columns in the matrix, respectively. The lower left corner of the heatmap corresponds to the first element X[1,1]
of the matrix. The parameter margin
is used to specify appropriate margins around the heatmap when this is to be combined with color bars and/or cluster dendrograms. Color bars (produced with the functions plotColorbarRow
and plotColorbarCol
) are plotted in the inner margin area, while cluster dendrograms (produced with the functions plotTreeRow
and plotTreeCol
) are plotted in the outer margin area. Both margins should be specified as a number between 0 and 1, and to leave no margins around the heatmap let margin=c(0,0)
.
A list with three elements colorscale
, value.range
and color.range
. The list is mainly intended to be used as input for the function plotColorRange
.
Ole Christian Lingjaerde
Nilsen et al., "Identifying clusters in genomics data by recursive partitioning", 2013 (in review)
plotColorbarCol
, plotColorbarRow
, plotTreeCol
, plotTreeRow
, plotColorRange
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## Create a data matrix
A = cbind(matrix(rnorm(70*20),nrow=70), matrix(3+rnorm(70*20),nrow=70))
B = cbind(-1 + matrix(rnorm(40*30),nrow=40), matrix(1+rnorm(40*10),nrow=40))
X = rbind(A,B)[sample(110), sample(40)]
## Cluster rows and columns
rowclust = hclust(dist(X, method="euclidean"), method="complete")
colclust = hclust(dist(t(X), method="euclidean"), method="average")
## Plot data in original order and in clustered order
par(mfrow=c(1,2))
plotHeatmap(X, c(0,0))
plotHeatmap(X[rowclust$order, colclust$order])
plotTreeRow(rowclust)
plotTreeCol(colclust)
## Identify groups with PART and color the leaves of the dendrogram accordingly
rowgroups = part(X, B=10, linkage="complete")$lab.hatK
colgroups = part(t(X), B=10)$lab.hatK
plotHeatmap(X[rowclust$order, colclust$order])
plotTreeRow(rowclust, rowgroups[rowclust$order])
plotTreeCol(colclust, colgroups[colclust$order])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.