簡體   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