相似矩阵的树形图和热图

时间:2018-04-06 19:49:22

标签: r heatmap hierarchical-clustering dendrogram

我已经为我的数据的成对比较计算了一个相似度矩阵,我想使用层次聚类和热图来可视化数据。

热图不是问题,但对于层次聚类,它似乎是在做我的相似性矩阵的距离矩阵(如果改变了事情,我使用包aheatmap),然后聚类

在热图的旁边,指定它已经是基于该数据的相似性矩阵和群集的最佳方法是什么?

谢谢!

1 个答案:

答案 0 :(得分:1)

您应该能够将对子指定为aheatmap。我用iris包试了一下。

NMF::aheatmap(iris[, 3:4]) # The default uses euclidean
NMF::aheatmap(iris[, 3:4], Rowv = 'manhattan', Colv = 'euclidean') # Specify what type of distance method to use on rows, and columns.

它还说你可以将外部群集传递给它。有关更多信息,请参阅?NMF :: aheatmap帮助文件。

hc <- hclust(dist(x, method = 'minkowski'), method = 'centroid')
aheatmap(x, Rowv = hc, info = TRUE)