plotTraitGramMultiPhylo: plotTraitGramMultiPhylo

View source: R/plotTraitGramMultiPhylo.R

plotTraitGramMultiPhyloR Documentation

plotTraitGramMultiPhylo

Description

Combine the node estimates based on random or specified fossil placement and plot them on a phylotrait gram in a specified directory.

Usage

plotTraitGramMultiPhylo(treedata_min, treedata_max, node_est, 
fossils=FALSE, use.paleoclimate=TRUE, paleoclimateUser=NULL, 
which.biovars, path="")

Arguments

treedata_min

tree data object with min estimate of the climate envelope

treedata_max

tree data object with max estimate of the climate envelope

node_est

the estimate of all the nodes, both min and max. Must be in format [[trees]][[permut]][2,species,trait]

fossils

a matrix with four columns of age to the closest million year integer, longitude, and latitude, in that order, and rows that are entries for fossil occurrences.

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()).

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

Details

plots a traitgram over multiple phylogenetic trees

Value

a trait gram for minimum and maximum of biovariables over a distribution of phylogenetic trees

Author(s)

A. Michelle Lawing, Alexandra F. C. Howard

See Also

plotTraitGram

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()
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]]<-lapply(1, function(p) full_est$est)
  envelope[[tr]] <- getEnvelopes(treedata_min[[tr]], treedata_max[[tr]], node_est[[tr]])
}
plotTraitGramMultiPhylo(treedata_min,treedata_max, node_est, which.biovars=1, 
path=paste(tempdir(),"/",sep=""))


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