Reverse-engineering, practice

library(gfdata)
ggplot(
  high_impact_stats,
  aes(
    x = ordered(year),
    y = tb_treatment_coverage_percent
  )
) +
  geom_boxplot() +
  scale_y_continuous(labels = scales::percent, limits = c(0, NA)) +
  theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5))
library(gfdata)
ggplot(high_impact_stats, aes(x = year)) +
  geom_ribbon(
    aes(
      ymin = people_living_with_hiv_aids_lower_number,
      ymax = people_living_with_hiv_aids_higher_number
    ),
    fill = "grey"
  ) +
  geom_line(
    aes(y = people_living_with_hiv_aids_number),
    color = "green"
  ) +
  facet_wrap(~country, scales = "free_y", ncol = 3) +
  scale_y_continuous(limits = c(0, NA))
high_impact_stats_tb_long <-
  high_impact_stats %>%
  select(
    iso3, country, five_regions, year,
    tb_new_cases_number, tb_deaths_number
  ) %>%
  gather(indicator, number, starts_with("tb_"))

ggplot(
  high_impact_stats_tb_long,
  aes(x = year, y = number, color = indicator)
) +
  geom_line() +
  facet_wrap(~country, scales = "free_y", ncol = 3) +
  scale_y_continuous(limits = c(0, NA))

Copyright © 2017 Kirill Müller. Licensed under CC BY-NC 4.0.