How to adjust sizes of x-axis in dendrogram (R)?

∥☆過路亽.° 提交于 2019-12-01 05:02:44

问题


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)

After the plot function is used, the dendrogram will be like this:

So, how I'm going to adjust the x-axis so then all the species are all clear seen.


回答1:


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.



来源:https://stackoverflow.com/questions/11444743/how-to-adjust-sizes-of-x-axis-in-dendrogram-r

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