Oouups, I forgot a line it should have been library(ape) tree = rtree(5) plot(tree) nodelabels() tiplabels() last_plot = get("last_plot.phylo", envir = .PlotPhyloEnv)
The xx and yy are the coordinates of the node (of the last plot) which are the numbers in tree$edge. points(last_plot$xx, last_plot$yy) If you have these coordinates you can write your own plot function plot(last_plot$xx, last_plot$yy) for(i in 1:nrow(tree$edge))lines(last_plot$xx[tree$edge[i,]], last_plot$yy[tree$edge[i,]]) Cheers, Klaus On Wed, Mar 1, 2017 at 8:58 AM, Wierzbinska, Justyna < j.wierzbin...@dkfz-heidelberg.de> wrote: > Dear Klaus, > > > > Thanks a lot for your help > > > > and what is in that case xx and yy? > > > > Justyna > > > > *From:* Klaus Schliep [mailto:klaus.schl...@gmail.com] > *Sent:* Friday, February 24, 2017 6:13 PM > *To:* Eduardo Ascarrunz > *Cc:* Wierzbinska, Justyna; r-sig-phylo@r-project.org > *Subject:* Re: [R-sig-phylo] distances between the nodes > > > > Dear Justyna > > tr$edge does not store coordinates, see help(phylo). > > if you want the coordinates of the nodes of your last plotted tree you can > get them: > library(ape) > tree = rtree(5) > nodelabels() > tiplabels() > last_plot = get("last_plot.phylo", envir = .PlotPhyloEnv) > last_plot$xx and last_plot$yy contain the coordinates of the nodes. > > there is also a (generic) function cophenetic() in ape to compute the > patristic distance and for larger trees this is much faster than distTips. > > Regards, > > Klaus > > > > > > On Fri, Feb 24, 2017 at 11:03 AM, Eduardo Ascarrunz <ear...@gmail.com> > wrote: > > Hi Justyna, > > > > If you want patristic distances (or node distances) you can use distTips > from the adephylo package. > > > > To make edgelabels show the branch lengths you can use > edgelabels(tr$edge.length) > > > > Does that do what you wanted? > > > > Cheers, > > > > Eduardo > > > > 2017-02-23 16:41 GMT+01:00 Wierzbinska, Justyna <j.wierzbinska@dkfz- > heidelberg.de>: > > > > Dear Ape users, > > > > I’be grateful for your help with my ape problems. > > I find it difficult to figure out how I can look at the distances between > the main nodes generated in the phylogenetic tree below. My idea is to > extract the distances between NBCs to hiMBCs. Somehow looking at the > exemplary object tr and using tr$edge and tr$edge.length it doesn’t seem to > be an easy task. > > > > > > *[image: cid:part1.C97E7A27.01EB5ADD@uq.edu.au]* > > > > I’ve tried to add node labels using nodelabels() and edge labels but > somehow the assigned labels are different then the coordinates stored in > the tr$edge would suggest (when I look at the tip projection). > > Any ideas how I can do it in an automatic way? Is it just a plotting > problem that the coordinates of edges don’t correspond to what I see in the > tree. > > > > > > Thank you very much. > > Kind regards, > > Justyna > > > > > > > > > > Division of Epigenomics and Cancer Risk Factors (C010) > > > > *German Cancer Research Center (DKFZ)* > > Foundation under Public Law > > Im Neuenheimer Feld 280 > > 69120 Heidelberg > > Germany > > +49 6221 42 <+49%206221%2042> 3359 > > j.wierzbin...@dkfz-heidelberg.de > > > > Management Board: Prof. Dr. Michael Baumann, Prof. Dr. Josef Puchta > > VAT-ID No.: DE143293537 > > > > > > _______________________________________________ > R-sig-phylo mailing list - R-sig-phylo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-phylo > Searchable archive at http://www.mail-archive.com/r- > sig-ph...@r-project.org/ > > > > > _______________________________________________ > R-sig-phylo mailing list - R-sig-phylo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-phylo > Searchable archive at http://www.mail-archive.com/r- > sig-ph...@r-project.org/ > > > > > -- > > Klaus Schliep > Postdoctoral Fellow > Revell Lab, University of Massachusetts Boston > http://www.phangorn.org/ > -- Klaus Schliep Postdoctoral Fellow Revell Lab, University of Massachusetts Boston http://www.phangorn.org/
_______________________________________________ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/