Saturday, October 19, 2019

New function to 'grow' birth-death tree in R

I just pushed a new update to phytools that rolls the phylogenetic animation that I illustrated in a recent blog plot into a new function called tree.grow( ).

Here's how it works:

library(phytools)
packageVersion("phytools")
tree.grow(b=0.08,d=0.04,t=100)

That's pretty cool.

To export a .gif like the one shown above it is necessary to install the free sofware ImageMagick and add it to the system environment Path. Then one can just run (for instance):

png(file="pbtree-%03d.png",width=700,height=700,res=144)
tree.grow(b=0.08,d=0.04,t=100)
dev.off()
system("ImageMagick convert -delay 5 -loop 0 *.png pbtree-anim.gif")
file.remove(list.files(pattern=".png"))

No comments:

Post a Comment

Note: due to the very large amount of spam, all comments are now automatically submitted for moderation.