plotAnimatedPPGM {ppgm} | R Documentation |
plotAnimatedPPGM
Description
This function creates an animated gif showing the change in modelled suitable habitat through time in geographic space.
Usage
plotAnimatedPPGM(envelope, tree, filename="ppgm.gif", which.biovars,
path="", use.paleoclimate=TRUE, paleoclimateUser=NULL, layerAge=c(0:20))
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 |
desired 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 |
layerAge |
vector with the ages of the paleoclimate dataframes, if using user submitted paleoclimate data |
Details
Requires ImageMagick or GraphicsMagick to be installed on the operating system. This is easy to do if you have macports. Just type sudo port install ImageMagick into terminal.
Value
An animated gif of species through time
Author(s)
A. Michelle Lawing, Alexandra F. C. Howard, Maria-Aleja Hurtado-Materon
Examples
data(sampletrees)
data(occurrences)
tree <- sampletrees[[25]]
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 <- geiger::treedata(tree,sp_data_min,sort=TRUE,warnings=F)
treedata_max <- geiger::treedata(tree,sp_data_max,sort=TRUE,warnings=F)
## Not run: full_est <- nodeEstimateEnvelopes(treedata_min,treedata_max)
node_est <- full_est$est
example_getEnvelopes <- getEnvelopes(treedata_min, treedata_max, node_est)
animatedplot <- plotAnimatedPPGM(example_getEnvelopes,tree,which.biovars=1,path=tempdir())
## End(Not run)