# Hi Vincenzo,
# You can proceed like this :
# The coordinates are used in the tiplabel function ; you can find its
code by writing :
tiplabel
# Those lines are of interest to us :
lastPP <- get("last_plot.phylo", envir = .PlotPhyloEnv)
tip <- 1:lastPP$Ntip
XX <- lastPP$xx[tip]
YY <- lastPP$yy[tip]
# We can compare :
library(phytools)
tree <- pbtree(n=20)
plot(tree)
tree$tip.label
# And :
YY # y coordinates of each tip from the bottom to the top
# This is exactly what we need !
# Here an example where I plot red points for tips 1-5, orange ones for
tips 6-10, yellow ones for tips 11-15 and green ones for tips 16-20 :
COL <- c( rep("red", 5), rep("orange", 5), rep("yellow", 5),
rep("green", 5) )
points(XX + 0.2, YY, col = COL)
# All the best,
# Gwen
Le 25/07/2013 06:29, Ellis, Vincenzo A. (UMSL-Student) a écrit :
Hi everyone,
I'm wondering if someone could tell me how to access the coordinates of the
tips on a phylogenetic tree. I'd like to be able to draw lines from the tips to
say the tips of another tree, or to points on a map, etc.
If you generate a random tree
library(phytools)
tree<- pbtree(n=20)
is there an easy way to do it? I think you can get the length from the base of
the tree to each tip using
nodeHeights(tree)
but I can't figure out how to get the other dimension (i.e., the spread of the
tips).
Thanks for any help!
Vincenzo
[[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/
--
Gwennaël BATAILLE, PhD student - Teaching assistant
Earth and Life Institute
Université Catholique de Louvain
SST/ELI/ELIB
Bâtiment Carnoy, c.145
Croix du sud 4-5, bte L7.07.04
1348 Louvain-la-Neuve
BELGIUM
_______________________________________________
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/