Create a ggplot2 visualization of prevalence over time. This is the recommended plotting function for R users, providing native R graphics that integrate with the R ecosystem (RStudio plots pane, R Markdown, etc.).
This function provides equivalent functionality to the Python
minte.create_scenario_plots() function but uses ggplot2 instead of
matplotlib.
Value
A ggplot2 object that can be printed, saved with ggsave(), or
further customized with ggplot2 functions.
See also
plot_cases()for plotting clinical casescreate_scenario_plots_mpl()for Python/matplotlib plotting (saves to files)
Examples
if (FALSE) { # \dontrun{
results <- run_minter_scenarios(...)
# Basic plot
p <- plot_prevalence(results)
print(p)
# Filter to specific scenarios
p <- plot_prevalence(results, scenarios = c("scenario_1", "scenario_2"))
# Customize with ggplot2
p <- plot_prevalence(results) +
ggplot2::theme_bw() +
ggplot2::scale_color_brewer(palette = "Set1")
# Save to file
ggplot2::ggsave("prevalence.png", p, width = 10, height = 6)
} # }