Skip to contents

Plots abundances obtained during simulation.

Usage

# S3 method for class 'sim_results'
plot(x, template = NULL, time_points = NULL, range, type, ...)

Arguments

x

sim_results object; returned by sim

template

SpatRaster object; can be used as a template to create returned object

time_points

numeric vector; specifies points in time from which plots will be generated

range

numeric vector of length 2; range of values to be used for the legend (if type = "continuous"), which by default is calculated from the N_map slot of sim_result object

type

character vector of length 1; type of map: "continuous" (default), "classes" or "interval" (case-sensitive)

...

further arguments passed to terra::plot

Value

SpatRaster object with as many layers as the length of time_points parameter

Examples

if (FALSE) { # \dontrun{
library(terra)

n1_small <- rast(system.file("input_maps/n1_small.tif", package = "rangr"))
K_small <- rast(system.file("input_maps/K_small.tif", package = "rangr"))

sim_data <- initialise(
  n1_map = n1_small,
  K_map = K_small,
  r = log(2),
  rate = 1 / 1e3
)
sim_res <- sim(sim_data, time = 10)
plot(sim_res)
plot(sim_res, template = n1_small, time_points = c(1, 10))

# plot specific area
plot(sim_res, xlim = c(4, 10), ylim = c(0, 10))
plot(sim_res, ext = c(4, 10, 0, 10))
plot(sim_res, template = n1_small, ext = c(274000, 280000, 610000, 620000))
} # }