繁体   English   中英

树状图的分​​层聚类的不同可视化

[英]Different visualization for hierarchical clustering of dendrogram

我希望可视化层次聚类的形状,其中一个内部互为形状。 亮度级别表示层次结构的级别。 让我通过示例向您展示我的想法:

# 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包可以产生类似的结果?

这只是部分答案。 您可以使用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)
}

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM