【问题标题】:Different visualization for hierarchical clustering of dendrogram树状图层次聚类的不同可视化
【发布时间】:2016-09-27 12:17:14
【问题描述】:

我想要一个层次聚类的可视化,其中一个形状在另一个里面。亮度等级代表层次的等级。 让我用一个例子来告诉你我的想法:

# Clustering small proportion of iris data   
clusters <- hclust(dist(iris[20:28, 3:4]), method = 'average')
# Visualizing the result as a dendogram    
plot(clusters)

现在我们可以如下转换树状图。

是否有任何 R 包可以产生类似的东西?

【问题讨论】:

  • 你知道我问的图有什么特别的名字吗?

标签: r data-visualization hierarchical-data hierarchical-clustering dendrogram


【解决方案1】:

这只是部分答案。您可以使用 cluster 包中的 clusplot 来朝那个方向发展。您可能可以通过更改clusplot 的源来改进这一点(输入getAnywhere(clusplot.default) 以获取源)。但是让你的气泡不重叠可能是一些工作。不管怎样,这是你从clusplot 得到的情节。一次查看一个单独的图而不是一起显示它们也可能很有趣。

# use sample data
df <- iris[20:28, 3:4]
# calculate hierarchical clustering
hfit <- hclust(dist(df), method = 'average')
# plot dendogram
plot(hfit)
# use clusplot at all possible cutoffs and show on top of each other.
library(cluster)
clusplot(df, cutree(hfit, 1), lines = 0)
for (i in 2:nrow(df)){
  clusplot(df, cutree(hfit, i), lines = 0, add = TRUE)
}

【讨论】:

    猜你喜欢
    • 2019-06-24
    • 2021-10-04
    • 2014-12-14
    • 2016-01-31
    • 2020-06-30
    • 2018-11-26
    • 2014-12-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多