如何调整树状图(R)中x轴的大小?
问题描述:
对于大型数据集,我想在显示所有标签的树状图中调整x轴.例如,我在这里使用虹膜数据:
I would like to adjust the x-axis in a dendrogram where all the labels are seen, for large data sets. As example, I use iris data here:
> iris.data=subset(iris,select=-Species)
> d <- dist(iris.data, method="euclidean")
> hc <- hclust(d, "ward")
> plot(hc, hang=-1, main="Dendrogram of Ward's Method", label=iris$Species)
使用plot函数后,树状图将如下所示:
After the plot function is used, the dendrogram will be like this:
所以,我将如何调整x轴,以便所有物种都清晰可见.
So, how I'm going to adjust the x-axis so then all the species are all clear seen.
答
就像@RomanLuštrik所说: 您可以这样:
Like @Roman Luštrik said : You can do like this :
png("plotdendogram.png",width=1600,height=800)
par(cex=1,font=3)
plot(hc, hang=-1, main="Dendrogram of Ward's Method", label=iris$Species)
dev.off()
尽管字体较小,您仍可以查看物种名称. 希望这会有所帮助.
You will be able to view species' names, although in small font size. Hope this helps.