Thanks again, Ben. Specifically my question should be;
If I know that I'll be using variables to represent the distances between species: a = AB b = AC d = CD and I also know my tree can be written as "((A:51.78,(C:24.6,D:24.6):27.18):40.06,B:91.84):0.0;" is there a way to allow me mark the edges without having to see the tree topology first, so that when I use "edgelabels", the symbols and the order ( c("a-b","b","b-d","d","d","a") ) should be automatically arranged other than being specified by me. In other words, I don't want to be the one who tells R the command "edgelabels(c("a-b","b","b-d","d","d","a"))". I'd rather a way R finds out itself. (for example, after some calculation, R knows the edgelabes should be the way specified above other than, say, c("a", "b", "c", "a-b", "a-c", "b-c"). ) Thank you! Hua --- Ben Bolker <[EMAIL PROTECTED]> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hua Li wrote: > > 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 > > > > How about > > > library(ape) > mytree = > "((A:51.78,(C:24.6,D:24.6):27.18):40.06,B:91.84):0.0;" > t1 = read.tree(text = mytree) > plot(t1) > edgelabels(c("a-b","b","b-d","d","d","a")) > str(t1) > t1$edge.length > names(t1$edge.length)[c(2,4,6)]=c("b","d","a") > plot(t1) > edgelabels(c("a-b","b","b-d","d","d","a"),adj=c(0.5,1.25)) > with(as.list(t1$edge.length), > > edgelabels(c(a-b,b,b-d,d,d,a),adj=c(0.5,-0.5),bg="lightblue")) > > ? > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.6 (GNU/Linux) > Comment: Using GnuPG with Mozilla - > http://enigmail.mozdev.org > > iD8DBQFHOao+c5UpGjwzenMRAq+xAJ4/FFxTaUXhco2ZSNU4xOHCHWhyQQCfYFV/ > 8ymnDHBrtFVDELiZrC2WQ+I= > =A1e3 > -----END PGP SIGNATURE----- > ____________________________________________________________________________________ Never miss a thing. Make Yahoo your home page. ______________________________________________ R-help@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.