本文介绍了R用聚类绘制热图,但隐藏树状图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,R的 heatmap 将群集行和列:

By default, R's heatmap will cluster rows and columns:

mtscaled = as.matrix(scale(mtcars))
heatmap(mtscaled, scale='none')

我可以禁用群集:

heatmap(mtscaled, Colv=NA, Rowv=NA, scale='none')

然后树状图消失:

但是现在数据不再聚类了.

But now the data is not clustered anymore.

我不希望显示树状图,但是我仍然希望对行和/或列进行聚类.我该怎么办?

I don't want the dendrograms to be shown, but I still want the rows and/or columns to be clustered. How can I do this?

我想要的示例:

推荐答案

library(gplots)
heatmap.2(mtscaled,dendrogram='none', Rowv=TRUE, Colv=TRUE,trace='none')

Rowv -is为TRUE,表示树状图是根据行均值进行计算和重新排序的.

Rowv -is TRUE, which implies dendrogram is computed and reordered based on row means.

Colv -列应与行相同.

这篇关于R用聚类绘制热图,但隐藏树状图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 04:58