[R] help on drawing a tree with "ape"?
Hua Li
hualihua at yahoo.com
Tue Nov 13 04:14:13 CET 2007
Thank you very much for the help, Ben!
As a follow up, is there a way to specify the labels,
through the way the text is written, rather than
reading the edge positions from the graph? For
example,
mytree =
"((A:51.78,(C:24.6,D:24.6):27.18):40.06,B:91.84):0.0;"
plot(read.tree(text = mytree))
edgelabels(c("a-b","b","b-d","d","d","a"))
would give the graph I want. You may notice that if
set a = 91.84; b= 51.78; d= 24.6, the labels I put on
each edge is the corresponding lengths in variable
form. The way I do it right now need me to first draw
the tree and then manually set the labels, and I
suppose there should be an easier way to get them by
reading the way the tree is written
("((A:51.78,(C:24.6,D:24.6):27.18):40.06,B:91.84):0.0;")?
Sorry for my low level questions. Just started using
"ape" and research on phylogenetic trees.
Best wishes,
Hua
--- Ben Bolker <bolker at ufl.edu> wrote:
>
>
>
> Hua Li wrote:
> >
> > Dear Simon and everyone,
> >
> > Thanks for response.
> >
> > Specifically, I have a tree with species "A, B, C"
> and
> > can be written as
> > "((A:45.15,C:45.15):46.19,B:91.34):0.0;" . If I
> use
> > the R command
> >> mytreeABC
> >
> > [1] "((A:45.15,C:45.15):46.19,B:91.34):0.0;"
> >
> >> plot(read.tree(text = mytreeABC))
> >
> > --- Simon Blomberg <s.blomberg1 at uq.edu.au> wrote:
> >
> >> ?edgelabels
> >>
> >
>
> Did you look at the examples in the file
> suggested by Simon?
> Unfortunately, the PS file but not the JPG came
> through in the
> version I read.
>
> It seems to me you may want _node_ labels rather
> than _edge_ labels? See below ...
>
> mytreeABC = "((A:45.15,C:45.15):46.19,B:91.34):0.0;"
> t1 = read.tree(text=mytreeABC)
> library(ape)
> plot(t1)
> edgelabels(1:4)
> nodelabels(c("a","b"))
>
> --
> View this message in context:
>
http://www.nabble.com/help-on-drawing-a-tree-with-%22ape%22--tf4789546.html#a13711995
> Sent from the R help mailing list archive at
> Nabble.com.
>
> ______________________________________________
> R-help at r-project.org 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.
>
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
More information about the R-help
mailing list