[R] coloring leaves in clustering

Martin Maechler maechler at stat.math.ethz.ch
Thu Nov 29 18:12:23 CET 2007


>>>>> "EC" == Eleni Christodoulou <elenichri at gmail.com>
>>>>>     on Thu, 29 Nov 2007 18:25:46 +0200 writes:

    EC> Hello everyone,
    EC> I wanted to know if it was possible to change the color of certain leaves in
    EC> a hclust object in order to make my graph more readable. I know I can color
    EC> certain groups but I would like to enter a vector telling the plot function
    EC> which leaves to color in which color.

Yes, you can do this.
Produce a "dendrogram" (S3 class) object from your hclust result

 hc <- hclust(...........)
 X <- as.dendrogram(hc)

and then "work with that" (add 'nodePar' properties to certain nodes).

  example(plot.dendrogram)

gives you a glimpse of the possibilities.
Someone else will have to give you details,
or provide you with utility functions maybe using
dendrapply() to achieve what you want.

Regards,
Martin Maechler, ETH Zurich

    EC> Thanks in advance,

    EC> Eleni

    EC> [[alternative HTML version deleted]]
    	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Please do avoid the above by *NOT* sending [text plus html] e-mails,
{as the posting guide has been asking ..}

    EC> ....

    EC> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
    EC> .....



More information about the R-help mailing list