Plot the syndrome combination tabulations from a computed CHAMPS object

plot_syndrome_combinations(
  x,
  x_name = "table",
  legend_location = "bottom",
  plot_type = "pie",
  include_text = NULL,
  full_separator = "\n"
)

Arguments

x

A data object obtained from calc_syndrome_combinations

x_name

One of the names objects from calc_syndrome_combinations - "table", "age_breakdown", or "tac_age_breakdown". Defaults to table.

legend_location

Can be one of "none", "bottom", "right", "left". Defaults to none.

plot_type

Either Pie Chart "pie" or Bar Chart "bar".

include_text

Whether to include the names "name", percentages "percent", numbers "number", names with numbers "full_number", or names with percentages "full_percent". Defaults to NULL which is none.

full_separator

the text to put between the name and full element. Defaults to a line break.

Details

x_name sets the color scale for each of the three items. The output from this function is a ggplot object so you can alter colors if needed.

Note that the labels may be cut off and that you would use a larger image size to include long names.

Examples

mock_syndrome <- calc_syndrome_combinations(mock,
condition = "Streptococcus pneumoniae",
syndrome_names = c(
  "Lower respiratory infections",
  "Meningitis/Encephalitis",
  "Neonatal sepsis",
  "Congenital infection"),
syndrome_values = c(
  "Pneumonia",
  "Meningitis",
  "Sepsis",
  "Sepsis"),
specimen_types = c(
  "Cerebrospinal fluid sample",
  "Tissue specimen from lung",
  "Whole blood")
)

plot_syndrome_combinations(mock_syndrome, legend_location = "none")
plot_syndrome_combinations(mock_syndrome, legend_location = "none",
  plot_type = "bar")
plot_syndrome_combinations(mock_syndrome, legend_location = "none",
  plot_type = "bar", include_text = "full_percent")
plot_syndrome_combinations(mock_syndrome, legend_location = "none",
  include_text = "full_percent")
plot_syndrome_combinations(mock_syndrome, "age_breakdown",
  legend_location = "none", include_text = "full_percent")
plot_syndrome_combinations(mock_syndrome, "tac_age_breakdown",
  legend_location = "none", include_text = "full_number")
plot_syndrome_combinations(mock_syndrome, "age_breakdown",
  legend_location = "none", include_text = "full_number",
  full_separator = ",")
plot_syndrome_combinations(mock_syndrome, "age_breakdown",
  plot_type = "pie", legend_location = "none",
  include_text = "full_number", full_separator = ",")
plot_syndrome_combinations(mock_syndrome, "tac_age_breakdown",
  plot_type = "bar", legend_location = "none",
  include_text = "full_number", full_separator = ",")