Description Usage Arguments Details Value Author(s) See Also Examples
Makes a heatmap without need for cluster analysis
1 2 3 4 5 6 7 8 9 | heatmap1(profiles, row.order = NULL, column.order = NULL, row.cluster = NULL,
column.cluster = NULL, column.labels = NULL, row.labels = NULL,
column.label.size = 3, row.label.size = 3,row.normalize=F)
make.heatmap1(profiles, row.method = "nMDS", column.method = "none",
row.metric = "pearson", column.metric = "pearson", row.cluster.method = "average",
column.cluster.method = "average", column.labels = NULL, row.labels = NULL,
row.label.size = 3, column.label.size = 3,row.normalize=F,
row.random.seed=NULL,column.random.seed=NULL)
|
profiles |
matrix: containing the data to be plotted. |
row.order |
vector containing order of rows such as produced by |
column.order |
vector containing order of columns such as produced by |
row.cluster |
hierarchical clustering result for rows of type |
column.cluster |
hierarchical clustering result for columns of type |
column.labels |
vector of labels for columns |
row.labels |
vector of labels for rows |
column.label.size |
size for column label text |
row.label.size |
size for row label text |
row.normalize |
logical: If true the rows are normalized to zero mean and unit variance |
row.method |
dimension reduction method used by |
column.method |
dimension reduction method used by |
row.metric |
Distance metric used by |
column.metric |
Distance metric used by |
row.cluster.method |
Clustering algorithm used for clustering rows. Either "average.linkage" or "complete.linkage". If NULL, no row cluster results are shown |
column.cluster.method |
Clustering algorithm used for clustering columns. Either "average.linkage" or "complete.linkage". If NULL, no column cluster results are shown |
row.random.seed |
Random seed to be used if nMDS is used to construct row ordering |
column.random.seed |
Random seed to be used in nMDS is used to generate column ordering |
The traditional heatmap uses clustering to order rows and columns. These functions allow us to use alternate schemes for this ordering. They use the same format as the traditional heatmap, and are therefore similar to image
and heatmap
. heatmap1
assumes the user has already ordered the rows and columns according to the scheme of their choice. make.heatmap1
is a convenience wrapper which performs ordering using "nMDS", "PCA", or hierarchical clustering. This ordering is the passed on to heatmap1
for plotting.
If "nMDS" or "PCA" are chosen as the ordering method, then it is assumed that their 2D embedding is annular in shape. This is often observed if PCA or nMDS (with euclidean distance) is applied to normalized data or Pearson correlation is used with nMDS. Angles measured at the centre of mass are then used for ordering. The user is therefore advised to confirm that such an annular structure is indeed present. Note that the two opposite ends of the ordering are typically separated by 360 degrees and are therefore very similar. To avoid artifacts produced by this, the user could consider using circularmap
instead.
The metric specified by row.metric
and column.metric
are also used by the clustering algorithms.
A ggplot2 plot of class ggplot
.
Satwik Rajaram and Yoshi Oono
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | make.heatmap1(mtcars,row.method="PCA",column.method="average.linkage")
#is equivalent to
mtcars.PCA<-prcomp(mtcars)
mtcars.PCA.order<-order(apply(mtcars.PCA$x[,1:2],1,function(x){atan2(x[1],x[2])}))
mtcars.column.cluster<-hclust(as.dist(1-cor(mtcars)),method="average")
mtcars.row.cluster<-hclust(as.dist(1-cor(t(mtcars))),method="average")
heatmap1(mtcars,row.order=mtcars.PCA.order,column.order=mtcars.column.cluster$order,
row.cluster=mtcars.row.cluster,column.cluster=mtcars.column.cluster)
#Changing Color Scheme
make.heatmap1(mtcars,row.method="PCA",column.method="average.linkage")+
scale_fill_gradient2(low="yellow",high="blue",mid="black",midpoint=200)
#Adding labels (the scale function ensures that labels are not clipped)
make.heatmap1(mtcars,row.method="PCA",column.method="average.linkage",
row.labels=rownames(mtcars),column.labels=colnames(mtcars))+
scale_x_continuous(lim=c(-1,15))
|
Loading required package: ggplot2
Loading required package: rgl
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE
3: .onUnload failed in unloadNamespace() for 'rgl', details:
call: fun(...)
error: object 'rgl_quit' not found
Scale for 'fill' is already present. Adding another scale for 'fill', which
will replace the existing scale.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.