plothist | R Documentation |
Plots the history of colonization events from a spatially-explicit forward simulation of population expansion.
plothist(ph, maxtime = NULL)
ph |
population history object (direct output from |
maxtime |
the maximum number of generations to plot, sets the end of the period where colonization history is plotted (i.e., |
This function takes a fine-grained spatio-temporal history of a species generated by holoSimCell's forward-time simulator and produces a map that shows population spread through time. The input object includes the following named components:
pophist
a data frame with population ID, cell row, cell column, timing of colonization, and source population associated with colonists.
Nvecs
a data frame with number of generations columns and number of populations rows that provides population size through time from the forward demographic simulation.
tmat
a matrix of pairwise migration rates between populations, used in coalescent simulations.
struct
a vector summarizing the structure of the simulated landscape from the forward simulation, x and y dimensions of the grid, number of generations, disperal parameters, etc.
hab_suit
a matrix with number of generations rows and number of populations columns that provides habitat suitability through time.
coalhist
a data frame specifying historical events for the coalescent simulation, includes time of event (time), source (src) and sink (snk) IDs, and fractional colonization (prop).
popslst
a list object with one element per population from the forward-time demographic simulation. Each element includes information on location on the landscape, colonization time, source populations, and population size through time.
Does not return an object, but creates a multi-panel plot illustrating the history of colonization of cells on the landscape (colored arrows, red arrows are associated with older events, yellow and white with more recent colonization), histogram illustrating the distribution of colonization times, and a simplified plot of centroid (mass-weighted range centroid - 'centroid' in enmSdm::bioticVelocity metrics
- and centroid of the northern portion of the range - 'nCentroid' in enmSdm::bioticVelocity metrics
) biotic velocity through time (generation-by-generation).
getpophist2.cells
, plotHistSlice
, bioticVelocity
library(holoSimCell)
parms <- drawParms(control = system.file("extdata/ashpaper","Ash_priors.csv",package="holoSimCell"))
load(file=paste0(system.file(package="holoSimCell"),"/extdata/landscapes/",pollenPulls[[1]]$file))
refpops <- pollenPulls[[1]]$refs
avgCellsz <- mean(c(res(landscape$sumrast)))
ph = getpophist2.cells(h = landscape$details$ncells, xdim = landscape$details$x.dim, ydim = landscape$details$y.dim,
landscape=landscape,
refs=refpops,
refsz=parms$ref_Ne,
lambda=parms$lambda,
mix=parms$mix,
shortscale=parms$shortscale*avgCellsz,
shortshape=parms$shortshape,
longmean=parms$longmean*avgCellsz,
ysz=res(landscape$sumrast)[2],
xsz=res(landscape$sumrast)[1],
K = parms$Ne)
plothist(ph)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.