# Simulated epi example: disease rates before/after intervention
intervention_data <- tibble(
county = c("Albany", "Saratoga", "Rensselaer", "Schenectady",
"Columbia", "Greene", "Warren", "Washington"),
before = c(15.2, 12.8, 18.1, 16.5, 11.3, 14.7, 9.8, 13.2),
after = c(11.1, 10.2, 12.4, 13.8, 9.5, 11.0, 8.1, 10.9)
) |>
mutate(change = after - before,
county = fct_reorder(county, change))
ggplot(intervention_data) +
geom_segment(aes(x = before, xend = after,
y = county, yend = county),
color = "grey60", linewidth = 1.2) +
geom_point(aes(x = before, y = county), color = "#D55E00",
size = 4) +
geom_point(aes(x = after, y = county), color = "#0072B2",
size = 4) +
annotate("text", x = 19, y = 8.3, label = "Before",
color = "#D55E00", fontface = "bold", size = 4.5) +
annotate("text", x = 19, y = 7.7, label = "After",
color = "#0072B2", fontface = "bold", size = 4.5) +
labs(title = "Every County Improved After the Intervention",
subtitle = "Rate per 1,000 population, before vs. after community health program",
x = "Rate per 1,000", y = NULL) +
scale_x_continuous(limits = c(7, 20))