Plot method for summary.seroincidence.by objects
Source: R/autoplot.summary.seroincidence.by.R
autoplot.summary.seroincidence.by.RdPlot method for summary.seroincidence.by objects
Usage
# S3 method for class 'summary.seroincidence.by'
autoplot(object, type, ...)Arguments
- object
a
summary.seroincidence.byobject (generated by applying thesummary()method to the output ofest_seroincidence_by()).- type
character string indicating which type of plot to generate. The implemented options are:
"scatter": callsstrat_ests_scatterplot()to generate a scatterplot"bar": callsstrat_ests_barplot()to generate a barplot
- ...
Arguments passed on to
strat_ests_scatterplot,strat_ests_barplotxvarthe name of a stratifying variable in
objectalphatransparency for the points in the graph (1 = no transparency, 0 = fully transparent)
shapeshape argument for
geom_point()dodge_widthwidth for jitter
CIslogical, if
TRUE, add CI error barscolor_varcharacter which variable in
objectto use to determine point colorgroup_varcharacter which variable in
objectto use to connect points with lines (NULLfor no lines)yvarthe name of a stratifying variable in
object.titlea title for the final plot.
xlaba label for the x-axis of the final plot.
ylaba label for the y-axis of the final plot.
fill_labfill label.
color_paletteoptional color palette for bar color.
Value
a ggplot2::ggplot() object
Examples
library(dplyr)
library(ggplot2)
xs_data <-
sees_pop_data_pk_100
curve <-
typhoid_curves_nostrat_100 %>%
filter(antigen_iso %in% c("HlyE_IgA", "HlyE_IgG"))
noise <-
example_noise_params_pk
est2 <- est_seroincidence_by(
strata = c("catchment", "ageCat"),
pop_data = xs_data,
sr_params = curve,
noise_params = noise,
curve_strata_varnames= NULL,
noise_strata_varnames = NULL,
antigen_isos = c("HlyE_IgG", "HlyE_IgA"),
num_cores = 2 # Allow for parallel processing to decrease run time
)
est2sum <- summary(est2)
est2sum |> autoplot(
type ="scatter",
xvar = "ageCat",
color_var = "catchment",
CIs = TRUE,
group_var = "catchment")
est2sum |> autoplot(
type = "bar",
yvar = "ageCat",
color_var = "catchment",
CIs = TRUE)