Skip to content

Commit

Permalink
improve example for plot_pop_size to show new relative option
Browse files Browse the repository at this point in the history
  • Loading branch information
tinigarske committed Jul 19, 2024
1 parent 5ed8568 commit 86c6cdc
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 2 deletions.
27 changes: 26 additions & 1 deletion R/plotting.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,37 @@ NULL
##' ## update the population immunity based on the vaccination activities:
##' pop <- apply_vacc(pop, vacc)
##'
##' ## plot the population immunity by age and time:
##' plot_immunity(pop)
##'
##' ## adding some population size manually:
##' ## adding some population size manually:
##' pop$pop_size <- pop$cohort - 1990
##'
##' ## plot the population size by age and time:
##' plot_pop_size(pop)
##'
##' ## plot the population immunity by age and time:
##' ##-----------------------------------------------------------------------
##' ## setting up a population with multiple regions:
##' pop <- popim_population(region = c("A", "B"),
##' year_min = 2000, year_max = 2005,
##' age_min = 0, age_max = 10)
##' pop$pop_size <- pop$cohort - 1990
##' pop$pop_size[pop$region == "A"] <- 5 * pop$pop_size[pop$region == "A"]
##'
##' ## adding some vaccination activities:
##' vacc <- popim_vacc_activities(region = c("A", "A", "B"),
##' year = c(2001, 2002, 2003),
##' age_first = c(0,0,0), age_last = c(0,0,10),
##' coverage = 0.8, doses = NA,
##' targeting = "random")
##' pop <- apply_vacc(pop, vacc)
##'
##' plot_immunity(pop)
##'
##' plot_pop_size(pop)
##' plot_pop_size(pop, rel = TRUE)
##'
plot_immunity <- function(pop, cols = c("whitesmoke", "midnightblue")) {

assert_population(pop)
Expand Down
27 changes: 26 additions & 1 deletion man/plotting.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 86c6cdc

Please sign in to comment.