Change label size of Cluster Dendrogram in R 3.01

旧巷老猫 提交于 2019-12-05 16:52:16

问题


Has anybody found a workaround to the apparent bug in R 3 which prohibits changing the label size on a Cluster Dendrogram?

The following code used to work fine before updating R to 3.01 (prior version was 2.15 I think):

plot(hclust, labels = data[, 1], cex = 0.3)

Now there is no change to label size when altering the cex argument.


回答1:


You could set the cex parameter using the par() function before the call to plot(). For example:

# example from ?hclust
hc <- hclust(dist(USArrests), "ave")

# default label size
plot(hc, xlab="xlab", ylab="ylab", main="main", sub="")

# reduced label size
par(cex=0.3, mar=c(5, 8, 4, 1))
plot(hc, xlab="", ylab="", main="", sub="", axes=FALSE)
par(cex=1)
title(xlab="xlab", ylab="ylab", main="main")
axis(2)


来源:https://stackoverflow.com/questions/17232178/change-label-size-of-cluster-dendrogram-in-r-3-01

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!