Skip to contents

Visualise simulation results of a stock-and-flow model. Plot the evolution of stocks over time, with the option of also showing other model variables.

Usage

# S3 method for class 'sdbuildR_sim'
plot(
  x,
  add_constants = FALSE,
  palette = "Dark 2",
  colors = NULL,
  font_family = "Times New Roman",
  font_size = 16,
  ...
)

Arguments

x

Output of simulate().

add_constants

If TRUE, include constants in plot. Defaults to FALSE.

palette

Colour palette. Must be one of hcl.pals().

colors

Vector of colours. If NULL, the colour palette will be used. If specified, will override palette. The number of colours must be equal to the number of variables in the simulation dataframe. Defaults to NULL.

font_family

Font family. Defaults to "Times New Roman".

font_size

Font size. Defaults to 16.

...

Optional parameters

Value

Plot object

Examples

sfm = xmile("SIR")
sim = simulate(sfm)
plot(sim)
# The default plot title and axis labels can be changed like so: plot(sim, main = "Simulated trajectory", xlab = "Time", ylab = "Value")