Learn R Programming

facilitation (version 0.5.2)

spatialanimation: Function for ploting simulation as a gif

Description

The spatialanimation function plots the individuals of the selected stages over time. Use plotsnapshot for plotting a single instant.

Usage

spatialanimation(data, times = seq(0, data$maxtime, length.out = 50),
  interval = 0.1, draw = data$num.total:1,
  radius = data$param$radius[draw], color = colorRampPalette(c("darkred",
  "lightgreen"))(length(draw)), movie.name = "facilitationmovie.gif",
  xlim = c(0, data$w), ylim = c(0, data$h))

plotsnapshot(data, t, ...)

Arguments

data

result of a simulation, created by community

times

array of times at which to plot

interval

a time length to wait between frames

draw

an array of stages id, to be drawn bottom to top. Absent stages will not be drawn.

radius

Optional. Array representing the sizes in which the individuals will be drawn. Defaults to interaction radius.

color

Optional. A color vector

movie.name

The filename of the gif that will be saved.

xlim

Optional. Limits to the x-axis

ylim

Optional. Limits to the y-axis

t

a single time at which to plot

additional parameters to be passed to spatialanimation

Examples

Run this code
# NOT RUN {
data(twospecies)
spatialanimation(twospecies,draw=c(5,3),times=seq(0,10,1),movie.name="ts.gif")
data(twospecies)
plotsnapshot(twospecies,t=10)
# }

Run the code above in your browser using DataLab