This line chart summarizes how monthly COVID-19 deaths change over the full time period in the dataset. The key value of this figure is that it makes it easy to identify periods of rapid increase (surges) and periods of decline. Because the values are aggregated by month, the trend is smoother than a daily series and better for broad interpretation.
ggplot(us_time, aes(x = date, y = covid_19_deaths)) +
geom_line(linewidth = 1.3, color = "#d62728") +
labs(
title = "COVID-19 Deaths Over Time",
x = "Date",
y = "COVID-19 Deaths"
) +
theme_minimal() +
theme(plot.title = element_text(size = 18, face = "bold"))
This plot compares monthly deaths attributed to COVID-19, pneumonia, and influenza. The main purpose is to show whether increases in COVID-19 deaths coincide with changes in other respiratory causes. This comparison helps contextualize COVID-19 severity relative to other respiratory illnesses that can fluctuate seasonally.
ggplot(us_time, aes(x = date)) +
geom_line(aes(y = covid_19_deaths, color = "COVID-19"), linewidth = 1.3) +
geom_line(aes(y = pneumonia_deaths, color = "Pneumonia"), linewidth = 1.3) +
geom_line(aes(y = influenza_deaths, color = "Influenza"), linewidth = 1.3) +
scale_color_manual(values = c(
"COVID-19" = "#d62728",
"Pneumonia" = "#1f77b4",
"Influenza" = "#2ca02c"
)) +
labs(
title = "Comparison of Death Causes Over Time",
x = "Date",
y = "Deaths",
color = "Cause"
) +
theme_minimal() +
theme(plot.title = element_text(size = 18, face = "bold"))
This bar chart ranks the top 15 states by total COVID-19 deaths in the dataset. Ranking states is useful for highlighting geographic concentration. The labels on each bar provide exact totals so the reader can compare magnitudes without estimating from the axis.
top_states <- df |>
dplyr::group_by(state) |>
dplyr::summarise(covid_19_deaths = sum(covid_19_deaths, na.rm = TRUE), .groups = "drop") |>
dplyr::arrange(desc(covid_19_deaths)) |>
dplyr::slice_head(n = 15)
ggplot(top_states, aes(x = reorder(state, covid_19_deaths), y = covid_19_deaths)) +
geom_col(fill = "#1f77b4") +
geom_text(aes(label = comma(covid_19_deaths)),
hjust = -0.08, size = 3.5) +
coord_flip() +
scale_y_continuous(labels = comma, expand = expansion(mult = c(0, 0.15))) +
labs(
title = "Top 15 States by COVID-19 Deaths",
x = "State",
y = "Total COVID-19 Deaths"
) +
theme_minimal() +
theme(
plot.title = element_text(size = 18, face = "bold"),
axis.text.y = element_text(size = 10)
)
This figure compares monthly COVID-19 deaths for males and females. It is useful for identifying whether outcomes differ systematically by sex and whether the gap changes during major waves. Interpreting this plot should be done carefully because observed differences can reflect both biological and non-biological factors (e.g., occupational exposure or underlying health differences).
sex_time <- df |>
dplyr::filter(sex %in% c("Male", "Female")) |>
dplyr::group_by(date, sex) |>
dplyr::summarise(covid_19_deaths = sum(covid_19_deaths, na.rm = TRUE), .groups = "drop")
ggplot(sex_time, aes(x = date, y = covid_19_deaths, color = sex)) +
geom_line(linewidth = 1.3) +
scale_color_manual(values = c(
"Male" = "#1f77b4",
"Female" = "#e377c2"
)) +
labs(
title = "COVID-19 Deaths by Sex Over Time",
x = "Date",
y = "Deaths",
color = "Sex"
) +
theme_minimal() +
theme(plot.title = element_text(size = 18, face = "bold"))
This figure shows monthly COVID-19 deaths across age groups. It is valuable because age is a major risk factor for severe outcomes, and the shape of the lines can show whether mortality risk shifted between age groups across different phases of the pandemic. Because several age groups are displayed simultaneously, the legend is necessary for interpretation.
age_time <- df |>
dplyr::filter(age_group != "All Ages") |>
dplyr::group_by(date, age_group) |>
dplyr::summarise(covid_19_deaths = sum(covid_19_deaths, na.rm = TRUE), .groups = "drop")
ggplot(age_time, aes(x = date, y = covid_19_deaths, color = age_group)) +
geom_line(linewidth = 1.2) +
scale_color_brewer(palette = "Spectral") +
labs(
title = "COVID-19 Deaths by Age Group Over Time",
x = "Date",
y = "Deaths",
color = "Age Group"
) +
theme_minimal() +
theme(plot.title = element_text(size = 18, face = "bold"))
## Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Spectral is 11
## Returning the palette you asked for with that many colors
## Warning: Removed 225 rows containing missing values or values outside the scale range
## (`geom_line()`).