Learn R Programming

steps (version 1.0.0)

plot.simulation_results: Plot the results of a simulation

Description

Methods to visually inspect the results of a simulation. Both linear graphs and spatial-explicit grids can be generated to illustrate population changes through time and space.

Usage

# S3 method for simulation_results
plot(
  x,
  object = "population",
  type = "graph",
  stages = NULL,
  animate = FALSE,
  timesteps = c(1:3),
  panels = c(3, 3),
  emp = FALSE,
  ...
)

Arguments

x

a simulation_results object

object

the simulation_results object to plot - can be 'population' (default), 'suitability' or 'carrying_capacity'

type

the plot type - 'graph' (default) or 'raster'

stages

life-stages to plot - by default all life-stages will be considered. Set to zero for totals (i.e. sum of all life-stages). For raster plotting, the life-stages that are specified will be summed, unless a single life-stage is specified.

animate

if plotting type 'raster' would you like to animate the rasters?

timesteps

timesteps to display when plotting rasters

panels

the number of columns and rows to use when plotting raster timeseries - default is 3 x 3 (e.g. c(3, 3) )

emp

should the expected minimum population of the simulation be plotted?

...

further arguments passed to/from other methods

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
ls <- landscape(population = egk_pop, suitability = egk_hab, carrying_capacity = egk_k)

pd <- population_dynamics(change = growth(egk_mat),
                          dispersal = kernel_dispersal(max_distance = 2000,
                                        dispersal_kernel = exponential_dispersal_kernel(
                                          distance_decay = 1000)),
                          density_dependence = ceiling_density())

sim <- simulation(landscape = ls,
                  population_dynamics = pd,
                  habitat_dynamics = NULL,
                  timesteps = 20)

# Plot the population trajectories by life-stage
plot(sim)

# Plot the spatial distributions of total populations for first nine timesteps
plot(sim, type = "raster", stages = 0, timesteps = 1:9) 
# }

Run the code above in your browser using DataLab