[英]How to reduce leaves length for fitting labels in R dendrogram?
I produced a cluster with hcluster
. 我用
hcluster
产生了一个簇。 original dendogram . 原始树状图 。
For formatting purposes I used as.dendogram
. 为了格式化,我使用
as.dendogram
。 When I did that my labels were cut of. 当我这样做时,我的标签被剪掉了。 vertical dendogram
垂直树状图
Even more by the horizontal orientation. 水平方向甚至更多。 The one I need.
我需要的那个。 horizontal dendogram
水平树状图
The problem does not seams to be in margins since (for the horizontal one) I used par(oma = c(0, 0, 0, 8)
with not label effect. It only a reduced my margins but not give more room for labels names. How can I make sure that the plot shows the entire model names? 因为我使用
par(oma = c(0, 0, 0, 8)
而不具有标签效果par(oma = c(0, 0, 0, 8)
所以这个问题不会出现在页边空白中,因为(对于水平的)我使用par(oma = c(0, 0, 0, 8)
。如何确定该图显示了整个模型名称?
You should probably change mar
and not oma
in par()
: 您应该在
par()
更改mar
而不是oma
:
mm <- matrix(rnorm(20), ncol = 4)
colnames(mm) <- c("leaf1", "leaf2", "leaf3", "very_long_leaf_realy")
# compare:
plot(as.dendrogram(hclust(dist(t(mm)))), horiz = TRUE)
# with:
oldpar <- par(mar = c(5, 4 ,4 , 8))
plot(as.dendrogram(hclust(dist(t(mm)))), horiz = TRUE)
par(oldpar) # restoring ploting parameters
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.