dendrogram - got it , just need to label :)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

dendrogram - got it , just need to label :)

Bunny, lautloscrew.com
Hi all, Hi Gavin,

thx for your help i finally found out what i want to do and how to  
fix it.
just needed to get some more level my cut level was too small...

two question remain...

a) can i somehow scale the twigs after cutting ?
b) how can i label the nodes and how to label which one...

thx !!

-m.

______________________________________________
[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
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: dendrogram - got it , just need to label :)

Steven McKinney

Here is one example of labeling nodes,
borrowing code from the help page for
the dendrapply() function.

local({
  edgeLab <<- function(n) {
      if(!is.leaf(n)) {
        a <- attributes(n)
        i <<- i+1
        attr(n, "edgetext") <-
            format(i)
      }
      n
  }
  i <- 0
 })
dL <- dendrapply(as.dendrogram(hclust(dist(iris[, 1:4]), method = "single")), edgeLab)
plot(dL)


This labels the edges above the nodes.

Martin Maechler and Robert Gentleman are developing the
dendrogram objects suite of functions.
As I have had to label nodes in S-PLUS, I'd like to put
in a request for a few more control parameters for
edge/internal node labeling control:

 - Allow the label without the polygon surrounding it.
   The polygon can obliterate too much of the dendrogram
   for larger sample sizes.  Perhaps an edgePar polygon
   plot logical p.plot taking values TRUE (default) and
   FALSE to omit the polygon.
 - Allow the label to appear near the node at the base
   of the edge.  Perhaps an edgePar text location parameter
   t.pos taking values in (0.0, 1.0) where 0.5 is in the
   middle of the edge (the default) and 1.0 is at the base
   of the edge.

Since clusters are not always identified by 'cutting'
the dendrogram (e.g. in the iris single linkage
dendrogram plot we want to identify internal nodes that
are large runts or whose vertical edge lengths are
considerably longer than average) it is useful to be able
to identify nodes deeper in the tree.  This is aided
by having access to internal node labels/names and being
able to extract internal nodes by those labels/names.


Best

Steven McKinney

Statistician
Molecular Oncology and Breast Cancer Program
British Columbia Cancer Research Centre

email: [hidden email]

tel: 604-675-8000 x7561

BCCRC
Molecular Oncology
675 West 10th Ave, Floor 4
Vancouver B.C.
V5Z 1L3
Canada




-----Original Message-----
From: [hidden email] on behalf of bunny , lautloscrew.com
Sent: Fri 3/9/2007 2:02 PM
To: [hidden email]
Subject: [R] dendrogram - got it , just need to label :)
 
Hi all, Hi Gavin,

thx for your help i finally found out what i want to do and how to  
fix it.
just needed to get some more level my cut level was too small...

two question remain...

a) can i somehow scale the twigs after cutting ?
b) how can i label the nodes and how to label which one...

thx !!

-m.

______________________________________________
[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
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[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
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: dendrogram - got it , just need to label :)

Bunny, lautloscrew.com
thx very much!
that helps to give those nodes somewhat dynamic names, so a legend to  
explain those numbers would be a solution, i´ll think about.
Anyway, is it possible to name the nodes by "hand", for example call  
node1 "myname1", node2 "something else" and so on ?


best

-m.


P.S.: Are there further packages you use for the dendrograms that you  
could recommend ?




Am 10.03.2007 um 04:33 schrieb Steven McKinney:

> local({
>   edgeLab <<- function(n) {
>       if(!is.leaf(n)) {
>         a <- attributes(n)
>         i <<- i+1
>         attr(n, "edgetext") <-
>             format(i)
>       }
>       n
>   }
>   i <- 0
>  })
> dL <- dendrapply(as.dendrogram(hclust(dist(iris[, 1:4]), method =  
> "single")), edgeLab)
> plot(dL)

        [[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
and provide commented, minimal, self-contained, reproducible code.