#======================================
#========= EDIT THESE VALUES ==========
#======================================
colors <- c("virusA" = "#34b7eb", "virusB" = "#bf8c15")
#======================================
# === THE CODE BELOW IS READY TO GO ===
#======================================
#load graphics library
library(ggplot2)
library(tibble)
#load the data
#timeline
week<-c(1,2,3,4,5,6,7,8,9,10)
#infections from virus type A and type B
virusA<-c(0,1,1,4,5,8,18,23,96,137)
virusB<-c(0,1,5,8,27,36,95,133,201,288)
data<-tibble("week" = week, "virusA" = virusA, "virusB" = virusB)
head(data)
ggplot(data, aes(x=week)) +
geom_line(aes(y = virusA, color="virusA"), linetype="solid") +
geom_line(aes(y = virusB, color="virusB"), linetype="solid") +
theme_minimal()+
labs(x = "Date",
y = "Number of Infections",
color = "Legend") +
ggtitle("Infection Count from Virus A and Virus B over 10 weeks")+
theme(axis.text.x = element_text(angle = 0, hjust = 1))+
scale_color_manual(values = colors)+
scale_x_continuous(breaks=seq(1, 10, 1))
Change the variable values to your own measured values.