his*_*eim 5 r cluster-analysis dendrogram traminer
我的树形图非常丑陋,处于不可读的边缘,通常看起来像这样:

library(TraMineR)
library(cluster)
data(biofam)
lab <- c("P","L","M","LM","C","LC","LMC","D")
biofam.seq <- seqdef(biofam[1:500,10:25], states=lab)
ccost <- seqsubm(biofam.seq, method = "CONSTANT", cval = 2, with.missing=TRUE)
sequences.OM <- seqdist(biofam.seq, method = "OM", norm= TRUE, sm = ccost,
with.missing=TRUE)
clusterward <- agnes(sequences.OM, diss = TRUE, method = "ward")
plot(clusterward, which.plots = 2)
Run Code Online (Sandbox Code Playgroud)
我想要创建的是类似下面的内容,意思是圆形树状图,可以仔细控制标签的大小,使它们实际可见:

我怎样才能在R中实现这一目标?
以下解决方案可能不是最佳的,但值得一试:
library(ape)
CL1 <- as.hclust(clusterward)
CL2 <- as.phylo(CL1)
plot(CL2, type="fan", cex=0.5)
Run Code Online (Sandbox Code Playgroud)

主要问题显然是对象太多,因此标签太多.要关闭标签,请使用参数show.tip.label=FALSE.您还可以通过以下方式摆脱占用整个设备的边距no.margin=TRUE:
plot(CL2, type="fan", show.tip.label=FALSE, no.margin=TRUE)
Run Code Online (Sandbox Code Playgroud)
