在R中,为什么我的层次结构聚类图看起来如此奇怪?

时间:2014-08-28 15:44:46

标签: r cluster-analysis hierarchical-clustering

这是我的数据:

Friendly<-c(0.533,0.854,0.9585,0.925,0.9125,0.9815,0.9645,0.981,0.9935,0.9585,0.996,0.956,0.9415)
Polite<-c(0,0.45,0.977,0.9915,0.929,0.981,0.9895,0.9875,1,0.96,0.996,0.873,0.9125)
Praising<-c(0,0,0.437,0.9585,0.9415,0.9605,0.998,0.998,0.8915,1,1,1,0.977)
Joking<-c(0,0,0,0.617,0.942,0.9665,0.9935,0.992,0.935,0.987,0.975,0.9915,0.9665)
Sincere<-c(0,0,0,0,0.617,0.8335,0.985,0.9895,0.977,0.9205,1,0.9585,0.8895)
Serious<-c(0,0,0,0,1,0.642,0.975,0.9605,0.9645,0.9895,0.8125,0.9605,0.925)
Hostile<-c(0,0,0,0,0,0,0.629,0.656,0.948,0.9705,0.9645,0.998,0.9685)
Rude<-c(0,0,0,0,0,0,0,0.687,0.979,0.954,0.954,0.996,0.956)
Irony<-c(0,0,0,0,0,0,0,0,0.354,0.9815,0.996,1,0.971)
Insincere<-c(0,0,0,0,0,0,0,0,1,0.396,0.996,0.9915,0.9415)
Commanding<-c(0,0,0,0,0,0,0,0,0,1,0.462,0.9605,0.9165)
Suggesting<-c(0,0,0,0,0,0,0,0,0,0,0,0.867,0.775)
Neutral<-c(0,0,0,0,0,0,0,0,0,0,0,0,0.283)

data <- data.frame(Friendly,Polite,Praising,Joking,Sincere,Serious,Hostile,Rude,Blaming,Insincere,Commanding,Suggesting,Neutral)

实际上,它是一个距离矩阵。使用R,我可以绘制一个包含该矩阵的聚类树形图:

dist<-as.dist(data) dist hc<-hclust(dist, method="ward.D") plot(hc, main="", ylab="", sub="", ann=T, axes=T, hang=0.3) 树形图如下所示:
enter image description here 但是,无论我如何在“hang =”之后设置参数,它仍然是一个树状图,有些组悬挂在天空或地面上有很长的分支。那么,如何解决这个问题呢?我想要的是一个树形图,其中标签的名称位于底部,分支不是那么长,并且裆部(节点)不再是最顶层的。
我想要的是这样的情节,任何人都可以帮助我吗?
enter image description here

0 个答案:

没有答案