[R] How to customize dendrogram plots {"cluster package"}

Martin Maechler maechler at stat.math.ethz.ch
Tue Dec 5 15:12:39 CET 2006


>>>>> "Mahdi" == Mahdi Osman <m_osm at gmx.net>
>>>>>     on Tue, 05 Dec 2006 13:06:26 +0100 writes:


    Mahdi> I am doing cluster analysis using the cluster package. I created a dendrogram using the function plot(agnes(myData)). When I try to change the sise of labels, it does not work. I tried cex = 1.5, etc. Nothing worked. Can anyone give me a hint on how to change the sise of the labels, as well as the sise of axes labels.

You need to learn 
  (1) finding out what you are doing, and
  (2) telling others more precisely about it ...

- As you see, plot() is "smart" about agnes() results;
  so you should read the help page for agnes.
  --> In it's "See also" section, there's several links,
  notably to 'plot.agnes' :
- Since agnes() has S3 class "agnes" (and 'plot()' is a (S3)
  generic function, it's the plot.agnes() method that is used.
  It's help page explains things about the two plots it draws,
  and then

  >>  For more customization of the plots, rather call 'bannerplot' and
  >>  'pltree' directly with corresponding arguments, e.g., 'xlab' or 'ylab'.

- From ?pltree, you are quickly lead on to  '?pltree.twins'
  and there, I hope you see the light:

  ---> use as.hclust() , as.dendrogram() and work with the very
  flexible plot() methods for "dendrogram"s.

  As always: "Learn from the examples"; in this case, already
       example(pltree.twins)
  shows you how to change the 'cex' (i.e. size) for the labels.

--- --- ---


 Morale Of The Story  
 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

 o short version:  RTFM

 o longer version: 

       1. Do read the help pages
       2. Do read the help pages carefully, and 
       3. Obey the "See also"
	  --> goto 1


Regards,
Martin Maechler ETH Zurich




More information about the R-help mailing list