library(openxlsx)
library(tidyverse)
library(clock)

df <- read.xlsx("/Users/krishshah/Downloads/owid-covid-data.xlsx")

df$date <- as.Date(df$date)

df_india <- df %>% filter(location == "India")

df_usa <- df %>% filter(location == "United States")

df_peru <- df %>% filter(location == "Peru")

df_india$date <- as.Date(df_india$date)

df_combined <- rbind(df_india, df_peru, df_usa)

ggplot(df_combined, aes(x = date, y = total_cases, color = location)) +
  geom_line(na.rm = TRUE) +
  geom_point(na.rm = TRUE) +
  scale_color_manual(values = c("India" = "black", "Peru" = "darkgreen", "United States" = "purple2")) +
  scale_x_date(
    breaks = seq(from = as.Date("2020-01-01"), to = Sys.Date(), by = "3 months"),
    date_labels = "%b %Y"
  ) +
  labs(x = "Date", y = "Total Cases", title = "COVID-19 Total Cases Over Time", caption = "Data provided by Our World in Data") +
  theme_classic() +
  theme(
    plot.background = element_rect(fill = "ivory"),
    panel.background = element_rect(fill = "ivory"),
    axis.text.x = element_text(angle = 45, hjust = 1, color = "black", family = "Times New Roman", size = 12),
    axis.text.y = element_text(color = "black", family = "Times New Roman", size = 12),
    axis.title.x = element_text(color = "black", family = "Times New Roman", size = 16),
    axis.title.y = element_text(color = "black", family = "Times New Roman", size = 16),
    plot.title = element_text(color = "black", family = "Times New Roman", size = 18, hjust = 0.5),
    legend.background = element_rect(fill = "ivory"),
    legend.text = element_text(color = "black", family = "Times New Roman", size = 12),
    legend.title = element_blank(),
    plot.caption = element_text(color = "black", family = "Times New Roman")
  )

ggplot(df_combined, aes(x = date, y = total_deaths, color = location)) +
  geom_line(na.rm = TRUE) +
  geom_point(na.rm = TRUE) +
  scale_color_manual(values = c("India" = "black", "Peru" = "darkgreen", "United States" = "purple2")) +
  scale_x_date(
    breaks = seq(from = as.Date("2020-01-01"), to = Sys.Date(), by = "3 months"),
    date_labels = "%b %Y"
  ) +
  labs(x = "Date", y = "Total Deaths", title = "COVID-19 Total Deaths Over Time", caption = "Data provided by Our World in Data") +
  theme_classic() +
  theme(
    plot.background = element_rect(fill = "ivory"),
    panel.background = element_rect(fill = "ivory"),
    axis.text.x = element_text(angle = 45, hjust = 1, color = "black", family = "Times New Roman", size = 12),
    axis.text.y = element_text(color = "black", family = "Times New Roman", size = 12),
    axis.title.x = element_text(color = "black", family = "Times New Roman", size = 16),
    axis.title.y = element_text(color = "black", family = "Times New Roman", size = 16),
    plot.title = element_text(color = "black", family = "Times New Roman", size = 18, hjust = 0.5),
    legend.background = element_rect(fill = "ivory"),
    legend.text = element_text(color = "black", family = "Times New Roman", size = 12),
    legend.title = element_blank(),
    plot.caption = element_text(color = "black", family = "Times New Roman")
  )

ggplot(df_combined, aes(x = date, y = total_deaths_per_million, color = location)) +
  geom_line(na.rm = TRUE) +
  geom_point(na.rm = TRUE) +
  scale_color_manual(values = c("India" = "black", "Peru" = "darkgreen", "United States" = "purple2")) +
  scale_x_date(
    breaks = seq(from = as.Date("2020-01-01"), to = Sys.Date(), by = "3 months"),
    date_labels = "%b %Y"
  ) +
  labs(x = "Date", y = "Total Deaths/Million", title = "COVID-19 Total Deaths/Million Over Time", caption = "Data provided by Our World in Data") +
  theme_classic() +
  theme(
    plot.background = element_rect(fill = "ivory"),
    panel.background = element_rect(fill = "ivory"),
    axis.text.x = element_text(angle = 45, hjust = 1, color = "black", family = "Times New Roman", size = 12),
    axis.text.y = element_text(color = "black", family = "Times New Roman", size = 12),
    axis.title.x = element_text(color = "black", family = "Times New Roman", size = 16),
    axis.title.y = element_text(color = "black", family = "Times New Roman", size = 16),
    plot.title = element_text(color = "black", family = "Times New Roman", size = 18, hjust = 0.5),
    legend.background = element_rect(fill = "ivory"),
    legend.text = element_text(color = "black", family = "Times New Roman", size = 12),
    legend.title = element_blank(),
    plot.caption = element_text(color = "black", family = "Times New Roman")
  )

ggplot(df_combined, aes(x = location, y = hospital_beds_per_thousand, fill = location)) +
  geom_col(show.legend = F) +
  scale_fill_manual(values = c("India" = "black", "Peru" = "darkgreen", "United States" = "purple2")) +
  labs(x = "Country", y = "Hospital Beds/Thousand", title = "Hospital Beds/Thousand by Country", caption = "Data provided by Our World in Data") +
  theme_classic() +
  theme(
    plot.background = element_rect(fill = "ivory"),
    panel.background = element_rect(fill = "ivory"),
    axis.text.x = element_text(angle = 45, hjust = 1, color = "black", family = "Times New Roman", size = 12),
    axis.text.y = element_text(color = "black", family = "Times New Roman", size = 12),
    axis.title.x = element_text(color = "black", family = "Times New Roman", size = 16),
    axis.title.y = element_text(color = "black", family = "Times New Roman", size = 16),
    plot.title = element_text(color = "black", family = "Times New Roman", size = 18, hjust = 0.5),
    legend.background = element_rect(fill = "ivory"),
    legend.text = element_text(color = "black", family = "Times New Roman", size = 12),
    legend.title = element_blank(),
    plot.caption = element_text(color = "black", family = "Times New Roman")
  )