在R 3.01中更改簇树状图的标签大小
问题描述:
有人发现R 3中明显的错误的变通办法,该错误禁止更改簇树状图上的标签大小吗?
Has anybody found a workaround to the apparent bug in R 3 which prohibits changing the label size on a Cluster Dendrogram?
以下代码在将R更新到3.01之前可以正常工作(我认为以前的版本是2.15):
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)
现在,更改cex
参数时,标签大小没有变化.
Now there is no change to label size when altering the cex
argument.
答
在调用plot()
之前,可以使用par()
函数设置cex
参数.例如:
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)