I just
updated
the phytools function phylo.to.map
(or, more accurately, the
phytools S3 method for objects of class "phylo.to.map"
) to
permit the use of ape functions nodelabels
, tiplabels
,
etc., by assigning the environmental variable "last_plot.phylo"
.
Here's a quick demo using some very simple simulated data:
## first install the latest version from GitHub
library(devtools)
install_github("liamrevell/phytools")
library(phytools)
## simulate tree & data
tree<-pbtree(n=26,scale=100,tip.label=LETTERS)
lat<-fastBM(tree,sig2=10,bounds=c(-90,90))
long<-fastBM(tree,sig2=80,bounds=c(-180,180))
obj<-phylo.to.map(tree,cbind(lat,long))
## objective: 108
## objective: 108
## objective: 108
## objective: 108
## objective: 108
## objective: 108
## objective: 104
## objective: 104
## objective: 104
## objective: 94
## objective: 94
## objective: 88
## objective: 88
## objective: 86
## objective: 84
## objective: 84
## objective: 84
## objective: 82
## objective: 82
## objective: 82
## objective: 82
## objective: 82
## objective: 82
## objective: 82
## objective: 80
## add nodelabels
nodelabels()
Note that if rotate=TRUE
in phylo.to.map
(the default) the
tree may have been rotated and consequently the node labels may not match the node
indices in the original input tree!
Here's another example of a use:
obj
## Object of class "phylo.to.map" containing:
##
## (1) A phylogenetic tree with 26 tips and 25 internal nodes.
##
## (2) A geographic map with range:
## -85.19N, 83.6N
## -180W, 180W.
##
## (3) A table containing 26 geographic coordinates.
par(fg=grey(0.4))
plot(obj,colors="black",ftype="off",lwd=1,lty="dotted",ylim=c(-90,100))
tiplabels(pch=19,col="red")
points(obj$coords[,2:1],col="red",pch=19)
Or something like this. Well, at least it adds some flexibility.
No comments:
Post a Comment
Note: due to the very large amount of spam, all comments are now automatically submitted for moderation.