View source: R/plots-heatmap.r
| HeatmapPlot | R Documentation |
A function to plot a heatmap of the agreement between two clustering results.
These are the clusters to which a comparison is made. A matrix is set up of which the columns are determined by the ordering of clustering of method 2 and the rows by the ordering of method 1. Every column represent one object just as every row and every column represent the color of its cluster. A function visits every cell of the matrix. If the objects represented by the cell are still together in a cluster, the color of the column is passed to the cell. This creates the distance matrix which can be given to the HeatmapCols function to create the heatmap.
HeatmapPlot(
Data1,
Data2,
names = NULL,
nrclusters = NULL,
cols = NULL,
plottype = "new",
location = NULL
)
Data1 |
The resulting clustering of method 1. |
Data2 |
The resulting clustering of method 2. |
names |
The names of the objects in the data sets. Default is NULL. |
nrclusters |
The number of clusters to cut the dendrogram in. Default is NULL. |
cols |
A character vector with the colours for the clusters. Default is NULL. |
plottype |
Should be one of "pdf","new" or "sweave". If "pdf", a location should be provided in "location" and the figure is saved there. If "new" a new graphic device is opened and if "sweave", the figure is made compatible to appear in a sweave or knitr document, i.e. no new device is opened and the plot appears in the current device or document. Default is "new". |
location |
If plottype is "pdf", a location should be provided in "location" and the figure is saved there. Default is NULL. |
A heatmap based on the distance matrix created by the function with the dendrogram of method 2 on top of the plot and the one from method 1 on the left. The names of the objects are depicted on the bottom in the order of clustering of method 2 and on the right by the ordering of method 1. Vertically the cluster of method 2 can be seen while horizontally those of method 1 are portrayed.
## Not run:
data(fingerprintMat)
data(targetMat)
data(Colors1)
MCF7_F = Cluster(fingerprintMat,type="data",distmeasure="tanimoto",normalize=FALSE,
clust="agnes",linkage="flexible",gap=FALSE,maxK=15)
MCF7_T = Cluster(targetMat,type="data",distmeasure="tanimoto",normalize=FALSE,
clust="agnes",linkage="flexible",gap=FALSE,maxK=15)
L=list(MCF7_F,MCF7_T)
names=c("FP","TP")
HeatmapPlot(Data1=MCF7_T,Data2=MCF7_F,names=rownames(fingerprintMat)
,nrclusters=7,cols=Colors1,plottype="new", location=NULL)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.