Learn R Programming

rase (version 0.2-21)

data.for.3d: Transform Output for 3D Plotting

Description

Takes the output from a rase run, the corresponding phylogenetic tree and tip polygonal distributions to create and object used for the different 3D plotting functions.

Usage

data.for.3d(res, tree, polygons)

Arguments

res
the output file from a rase run.
tree
phylogenetic tree of class "phylo" used as input for rase.
polygons
list of polygons in owin.object format used as input for rase.

Value

  • Returns an object required by the plotting functions phylo.3d, add.dens and add.polygons. It is efectively a list with the following elements: $xyz containing the 3D coordinates, $edge containing the tree$edge and $pol containing the polygons.

References

Quintero, I., Keil, P., Jetz, W., Crawford, F. W. 2015 Historical Biogeography Using Species Geographical Ranges. Systematic Biology. doi: 10.1093/sysbio/syv057

See Also

phylo.3d, add.dens, add.polygons, rase

Examples

Run this code
# load the mcmc results from rase run, polygons and tree
data(rase_data, package = 'rase')

pnames <- c('dextralis', 'viridis', 'leucoptera', 'interjecta', 
'obscura', 'crepitans', 'ochroptera', 'napensis')
psophia_poly <- name.poly(psophia_poly, psophia_tree, poly.names = pnames)

# transform the data for 3d plotting
df3 <- data.for.3d(mcmc, psophia_tree, psophia_poly)

# plot the tree in 3D
phylo.3d(df3, z.scale = 10, pts = TRUE)

# add the polygons representing the tip distributions
add.polygons(df3)

# add the posterior density at each node of the 3d tree

if(requireNamespace("rpanel") && requireNamespace("tcltk"))
  add.dens(df3, mcmc, z.scale = 10, col = c(2:8))

Run the code above in your browser using DataLab