Skip to contents

Plot setting matrices using ggplot2

Usage

# S3 method for conmat_prediction_matrix
autoplot(object, ..., title = "Contact Matrices")

# S3 method for conmat_setting_prediction_matrix
autoplot(object, ..., title = "Setting-specific synthetic contact matrices")

Arguments

object

A matrix or a list of square matrices, with row and column names indicating the age groups.

...

Other arguments passed on

title

Title to give to plot setting matrices. Default title for plotting a single contact matrix is "Contact Matrices" and for setting wise contact matrix it is "Setting-specific synthetic contact matrices".

Value

a ggplot visualisation of contact rates

Examples

if (FALSE) {
if (interactive()) {
  polymod_contact_data <- get_polymod_setting_data()
  polymod_survey_data <- get_polymod_population()

  setting_models <- fit_setting_contacts(
    contact_data_list = polymod_contact_data,
    population = polymod_survey_data
  )

  fairfield_age_pop <- abs_age_lga("Fairfield (C)")

  fairfield_hh_size <-
    get_per_capita_household_size(lga = "Fairfield (C)")

  synthetic_settings_5y_fairfield_hh <- predict_setting_contacts(
    population = fairfield_age_pop,
    contact_model = setting_models,
    age_breaks = c(seq(0, 85, by = 5), Inf),
    per_capita_household_size = fairfield_hh_size
  )

  # Plotting synthetic contact matrices across all settings

  autoplot(
    object = synthetic_settings_5y_fairfield_hh,
    title = "Setting specific synthetic contact matrices"
  )

  # Work setting specific synthetic contact matrices
  autoplot(
    object = synthetic_settings_5y_fairfield_hh$work,
    title = "Work"
  )
}
}