plotAnimatedPPGMMultiPhylo: plotAnimatedPPGMMultiPhylo

View source: R/plotAnimatedPPGMMultiPhylo.R

plotAnimatedPPGMMultiPhyloR Documentation

plotAnimatedPPGMMultiPhylo

Description

This function creates an animated gif showing the change in modeled suitable habitat through time in geographic space. It requires ImageMagick or GraphicsMagick to be previously installed in the operating system. This is easy to do if you have macports. Just type sudo port install ImageMagick into terminal.

Usage

plotAnimatedPPGMMultiPhylo(envelope, tree, filename="ppgm.gif", 
which.biovars, path="", use.paleoclimate=TRUE, paleoclimateUser=NULL)

Arguments

envelope

the min and max envelope of each lineage for each time slice

tree

the phylogeny or multiple phylogenies that show the relationship between species

filename

filename of output

which.biovars

A vector of the numbers of the bioclimate variables that should be returned. The bioclimate variables number correspond to the Hijmans table at (https://www.worldclim.org/data/bioclim.html).

path

path to the directory where the results should be saved

use.paleoclimate

if left blank, default North America paleoclimate data is used. If FALSE, user submitted paleoclimate must be provided

paleoclimateUser

list of data frames with paleoclimates, must be dataframes with columns: GlobalID, Longitude, Latitude, bio1, bio2,...,bio19. (see getBioclimvars()).

Details

Animated gif of species richness through time

Author(s)

A. Michelle Lawing, Alexandra F. C. Howard

Examples

data(sampletrees)
data(occurrences)
sampletrees <- sample(sampletrees,5)
biooccu <- getBioclimVars(occurrences, which.biovars=1)
sp_data_min<- tapply(biooccu[,4],biooccu$Species,min)
sp_data_max<- tapply(biooccu[,4],biooccu$Species,max)
treedata_min <- treedata_max <- node_est <- envelope <- list()
## Not run: for (tr in 1:length(sampletrees)){
  treedata_min[[tr]] <- geiger::treedata(sampletrees[[tr]],sp_data_min,sort=TRUE,warnings=F)
  treedata_max[[tr]] <- geiger::treedata(sampletrees[[tr]],sp_data_max,sort=TRUE,warnings=F)
  full_est <- nodeEstimateEnvelopes(treedata_min[[tr]],treedata_max[[tr]])
  node_est[[tr]] <- full_est$est
  envelope[[tr]] <- getEnvelopes(treedata_min[[tr]], treedata_max[[tr]], node_est[[tr]])
}
animatedplot <- plotAnimatedPPGMMultiPhylo(envelope,sampletrees,which.biovars=1, path=tempdir())
## End(Not run)

michellelawing/ppgm documentation built on April 24, 2024, 10:17 p.m.