Hi Chris.

To get the coordinates of the nodes of a plotted tree (plotted with
plot.phylo or plotTree, among other functions), type:

plot(tree) ## for instance
obj<-get("last_plot.phylo",envir=.PlotPhyloEnv)

The vectors obj$xx and obj$yy contain the coordinates of the nodes
(including the tips) of the tree in the order of the node indices of
tree$edge. So, for instance, should you know that you want to add an
element at the coordinates of the common ancestor of "t1" and "t8" you
could do:

anc<-fastMRCA(tree,"t1","t8") ## for example
points(obj$xx[anc],obj$yy[anc],pch=19)

This works for all different tree types in plot.phylo, plotTree, and plot.simmap, and also for plotted phylomorphospaces (using phytools::phylomorphospace), traitgrams (using phytools::phenogram), and contMap or densityMap still graphs.

All the best, Liam

Liam J. Revell, Associate Professor of Biology
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: liam.rev...@umb.edu
blog: http://blog.phytools.org

On 5/11/2016 2:43 PM, Chris Buddenhagen wrote:
Is there a way to quickly associate a small graph created in R with
each node on a tree and have the graphic appear on the node when
plotted?

Or alternatively is there a way to get out the node coordinates of
each node for a given plot?

Sincerely

Chris Buddenhagen cbuddenha...@gmail.com

[[alternative HTML version deleted]]

_______________________________________________ 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/


_______________________________________________
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/

Reply via email to