Description Usage Arguments Details Value Examples
Plots the total fraction of Susceptible, Infected and Recovered individuals at each time step.
1 2 | plot_simulation(results, num_areas, num_ages, by_age = F, step = 1,
pretty = F, title = NULL)
|
results |
The object containing the results from the simulation. |
num_areas |
The number of areas in the simulation. Easy way to get it for your current simulation is to use the dimension of your transmission kernel (e.g. if you have 4 age groups: dim(expanded_D)[1]/4). |
num_ages |
The number of ages in the simulation. |
by_age |
Logical. If TRUE, will create a plot for each age category (only works with pretty = FALSE). |
step |
Timestep used for the simulation, in days (default is 1 day). |
pretty |
Logical. If TRUE, will render using ggplot (longer but nicer). |
title |
Title to use for the plot. |
The Infected category has a separate y-axis to make visualisation easier, due to the relatively low fraction of Infected at any given time compared to Susceptible and Recovered.
Creates a plot.
1 2 3 4 5 6 7 8 9 10 11 | #Create a spatial dataset:
test_data = raster(nrow=10, ncol=10, xmn=1, xmx=100000, ymn=1, ymx=100000)
values(test_data) = runif(100, 1, 1000)
#Calculate the parameters for the simulation:
prep_simulation(test_data)
#Run the simulation:
results = run_simulation(test_data, expanded_D, contact_mat, beta)
plot_simulation(results, dim(expanded_D)[1]/4, 4, pretty=T, title="SIR plot")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.