library(ggplot2)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(patchwork)
library(hrbrthemes)
## NOTE: Either Arial Narrow or Roboto Condensed fonts are required to use these themes.
## Please use hrbrthemes::import_roboto_condensed() to install Roboto Condensed and
## if Arial Narrow is not on your system, please see https://bit.ly/arialnarrow
library(readr)
Frost <- read_csv("Frost.csv")
## Warning: Missing column names filled in: 'X1' [1]
## Parsed with column specification:
## cols(
## X1 = col_double(),
## gen = col_double(),
## new = col_double(),
## sus = col_double()
## )
View(Frost)
head(Frost)
## # A tibble: 6 x 4
## X1 gen new sus
## <dbl> <dbl> <dbl> <dbl>
## 1 1 0 0 100
## 2 2 1 1 99
## 3 3 2 2 97
## 4 4 3 4 93
## 5 5 4 6 87
## 6 6 5 11 76
Frost <- Frost %>%
rename(gen, Generation_of_Epidemic = gen,
new, New_Cases_in_Generation = new,
sus, Remaining_Susceptibles = sus)
P1 <- ggplot(Frost, aes(x=Generation_of_Epidemic, y=New_Cases_in_Generation)) + geom_line(color="69b3a2", size=2) + ggtitle("New Cases in Generation") + theme_ipsum()
P2 <-ggplot(Frost, aes(x=Generation_of_Epidemic, y=Remaining_Susceptibles)) + geom_line(color="grey", size=2) + ggtitle("Remaining Susceptibles") + theme_ipsum()
ggplot(Frost, aes(x=Generation_of_Epidemic, y=New_Cases_in_Generation)) +
scale_y_continuous(name = "New Cases in Generation",
sec.axis = sec_axis (trans=~.*10, name = "Remaining Susceptibles")) + theme_ipsum()
