5

我的树状图非常丑陋,几乎无法阅读,通常看起来像这样:

在此处输入图像描述

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)

我想要创建类似于以下内容的内容,即圆形树状图,其中可以仔细控制标签的大小,以便它们实际可见:

在此处输入图像描述

我怎样才能在 R 中做到这一点?

4

1 回答 1

9

以下解决方案可能不是最佳的,但值得一试:

library(ape)
CL1 <- as.hclust(clusterward)
CL2 <- as.phylo(CL1)
plot(CL2, type="fan", cex=0.5)

在此处输入图像描述

主要问题显然是仍然有太多对象,因此标签太多。要关闭标签,请使用参数show.tip.label=FALSE。您还可以通过以下方式摆脱边缘以占据整个设备no.margin=TRUE

plot(CL2, type="fan", show.tip.label=FALSE, no.margin=TRUE)

在此处输入图像描述

于 2014-01-28T16:14:38.607 回答