Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

tree.grow

Creates an animation of a tree growing from left-to-right or upwards


Description

This function simulates a birth-death tree under user-defined conditions and then creates an animation of that tree growing from left-to-right in the plotting device, or upwards.

Usage

tree.grow(..., res=200, direction="rightwards", ladderize=TRUE)

Arguments

...

arguments to pass to pbtree.

res

number of steps (the resolution of the animation). This also corresponds to the number of frames that will be created if the animation is to be converted to a .gif file.

direction

the direction to plot the tree. Only direction="rightwards" (the default) and direction="upwards" are supported.

ladderize

logical value indicating whether or not to 'ladderize' the plotted tree. (Defaults to TRUE.)

Value

An object of class "phylo".

Author(s)

References

Revell, L. J. (2012) phytools: An R package for phylogenetic comparative biology (and other things). Methods Ecol. Evol., 3, 217-223.

See Also

Examples

## Not run: 
## to create a .gif with ImageMagick installed
png(file="pbtree-
tree.grow(b=0.06,d=0.02,t=100)
dev.off()
system("ImageMagick convert -delay 5 -loop 0 *.png pbtree-anim.gif")
## End(Not run)

phytools

Phylogenetic Tools for Comparative Biology (and Other Things)

v0.7-70
GPL (>= 2)
Authors
Liam J. Revell
Initial release
2020-9-19

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.