Justification of dendrogram labels

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Justification of dendrogram labels

Duncan Mackay
Hi all,
Can someone tell me how to justify (right or left) the labels on the
branches of a dendrogram tree? I have produced a dendrogram via agnes and
plotted it with pltree. The dendrogram terminal branch labels seem to be
centre-justified by default and I was hoping to change this to left
justification. Thanks,
Duncan


*****************************************
Dr. Duncan Mackay
School of Biological Sciences
Flinders University
GPO Box 2100
Adelaide
S.A.    5001
AUSTRALIA

Ph (08) 8201 2627    FAX (08) 8201 3015

http://www.scieng.flinders.edu.au/biology/people/mackay_d/index.html
 


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Justification of dendrogram labels

Martin Maechler
>>>>> "DMackay" == Duncan Mackay <[hidden email]>
>>>>>     on Fri, 27 Jan 2006 11:46:11 +1030 writes:

    DMackay> Hi all,
    DMackay> Can someone tell me how to justify (right or left) the labels on the
    DMackay> branches of a dendrogram tree? I have produced a dendrogram via agnes and
    DMackay> plotted it with pltree. The dendrogram terminal branch labels seem to be
    DMackay> centre-justified by default and I was hoping to change this to left
    DMackay> justification. Thanks,

No, you can't when using pltree().  But you can by other means:

I just now realize how scarce  help(pltree)
and help(pltree.twins) are on this --- and I will improve these help pages.
pltree() leads to the following call sequence:
  pltree() -> cluster:::pltree.twins -> stats:::plot.hclust()

and the plot.hclust() function, the S3 method for plot()ting  "hclust"
objects, delves into fast but rather inflexible C code.

This has been one of the reasons why the "dendrogram" (S3) class
had been introduced. These are more flexible and have a more
flexible plot method.
--> help(plot.dendrogram)
    and the "graphics show" you get from example(as.dendrogram).
    (and then study the 'Examples:' section of the help page
     more carefully).

To coerce agnes() results to "dendrogram", you need something like

  aa <- agnes(..........)

  dd <- as.dendrogram(as.hclust(aa))

  ## and now
  plot(dd)
  ## or
  plot(*, ..........)

--
Martin Maechler, ETH Zurich

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html