View source: R/sim2Animation.R
sim2Animation | R Documentation |
Animates BAM simulation object.
sim2Animation( sdm_simul, which_steps, fmt = "GIF", filename, png_keyword = "sdm_sim", extra_legend = NULL, bg_color = "#F6F2E5", suit_color = "#0076BE", occupied_color = "#03C33F", gif_vel = 0.8, ani.width = 1200, ani.height = 1200, ani.res = 300 )
sdm_simul |
A bam object. See |
which_steps |
A numeric vector indicating the simulation steps that are going to be converted into raster layers. |
fmt |
Animation format. Posible values are GIF and HTML |
filename |
File name. |
png_keyword |
A keyword name for the png images generated by the function |
extra_legend |
A legend to add to the animation. |
bg_color |
Color for unsuitable pixels. Default "#F6F2E5". |
suit_color |
Color for suitable pixels. Default "#0076BE". |
occupied_color |
Color for occupied pixels. Default "#03C33F". |
gif_vel |
A value that regulates the velocity of frame transitions. The bigger it is the transition will be slower default 0.8 |
ani.width |
Animation width unit in px |
ani.height |
Animation height unit in px |
ani.res |
Animation resolution unit in px |
A RasterStack of species' distribution at each simulation step
## Not run: model_path <- system.file("extdata/Lepus_californicus_cont.tif", package = "bam") model <- raster::raster(model_path) >0.1 sparse_mod <- bam::model2sparse(model) adj_mod <- bam::adj_mat(sparse_mod,ngbs=2) occs_lep_cal <- data.frame(longitude = c(-115.10417, -104.90417), latitude = c(29.61846, 29.81846)) occs_sparse <- bam::occs2sparse(modelsparse = sparse_mod, occs = occs_lep_cal) sdm_lep_cal <- bam::sdm_sim(set_A = sparse_mod, set_M = adj_mod, initial_points = occs_sparse, nsteps = 50) ani_name <- "C:/Users/l916o895/Dropbox/TeoriadeBAM/ani_test.html" sdm_lep_cal_st <- bam::sim2Animation(sdm_simul = sdm_lep_cal, which_steps = seq(1,50,by=1), fmt = "HTML",ani.width = 1200, ani.height = 1200, filename = ani_name) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.