Nothing
knitr::opts_chunk$set( collapse = TRUE, comment = "#>", warning = FALSE, message = FALSE, fig.width = 7, fig.height = 4 )
library(ggplot2) library(dplyr) library(tidyr) library(outbreaks) library(ggsurveillance)
This vignette is still work in progress. But the examples are hopefully already helpful and inspiring.
ggplot(outbreaks::ebola_kikwit_1995, aes(x = date, weight = onset)) + geom_epicurve(date_resolution = "week") + scale_x_date(date_breaks = "2 weeks", date_labels = "%V'%g", name = "week") + scale_y_cases_5er() + theme_bw()
outbreaks::sars_canada_2003 |> pivot_longer(starts_with("cases"), names_prefix = "cases_", names_to = "origin") |> ggplot(aes(x = date, weight = value, fill = origin)) + geom_epicurve(date_resolution = "week") + scale_y_cases_5er() + theme_bw()
align_dates_seasonal()
defines the influenza seasonsgeom_vline_year()
marks the turn of the yearsscale_y_cases_5er()
creates a y-axis with more ticks and aligns 0 with the x-axis.influenza_germany |> # Keep Age Groups 00-14, 15-59, 60+ filter(AgeGroup != "00+") |> # Calc Influenza Seasons align_dates_seasonal(dates_from = ReportingWeek) |> ggplot(aes(x = ReportingWeek, weight = Cases, fill = season)) + # , weight = Cases geom_vline_year(color = "grey50") + geom_epicurve(color = NA, stat = "bin_date", date_resolution = "week") + scale_y_cases_5er() + theme_bw()
influenza_germany |> # Calc Influenza Seasons align_dates_seasonal(dates_from = ReportingWeek) |> ggplot(aes(x = ReportingWeek, weight = Cases, color = AgeGroup)) + # , weight = Cases geom_line(stat = "bin_date", date_resolution = "month") + scale_y_cases_5er() + facet_wrap(~AgeGroup) + theme_bw()
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.