knitr::opts_chunk$set(echo = FALSE)
library(CoV19)
p <- my_plot(italy, "Lombardia", "2020-03-10") p + geom_vline(xintercept = as.Date("2020-05-04"), linetype = "dashed") + annotate("text", x=as.Date("2020-05-04")+0.5, y=42000, hjust=0, label="lockdown eased", color="red", size=3, angle=90, vjust=1)
x <- subset(world, region=="Washington US") # tmp <- x[1,] # tmp$date <- as.Date("2020-04-04") # tmp[1,!colnames(tmp) %in% c("date", "region")] <- NA # tmp$positive <- 7984; tmp$death <- 308 # x <- rbind(x, tmp) reg <- "Washington US" p <- my_plot(x, reg) + xlim(as.Date("2020-03-01"), Sys.Date()) p <- add_vline(p, "restaurants close", "2020-03-16") p <- add_vline(p, "12 days past restaurants closed", "2020-03-28", linetype="dashed") p <- add_vline(p, "stay at home order", "2020-03-23") p <- add_vline(p, "SIP eased - parks open", "2020-05-08", linetype="dashed") p
reg = "King Washington US" p <- my_plot(world, reg) + xlim(as.Date("2020-03-01"), Sys.Date()) p <- add_vline(p, "restaurants close", "2020-03-16") p <- add_vline(p, "12 days past restaurants closed", "2020-03-28", linetype="dashed") p <- add_vline(p, "stay at home order", "2020-03-23") p <- add_vline(p, "SIP eased - parks open", "2020-05-08", linetype="dashed") p
b=subset(states, region=="WA") tmp=diff(b$total.tests) plot(b$date[-1], zoo::rollapply(tmp,7,mean,fill=NA),type="l",ylab="tests (7-day average)", xlab="") par(new=TRUE) tmp=diff(b$positive)/diff(b$total.tests) tmp[b$date[-1]<as.Date("2020-03-03")] <- NA plot(b$date[-1], 100*zoo::rollapply(tmp,7,mean,na.rm=TRUE,fill=NA),yaxt="n", ylab="", ylim=c(0,20), type="l", lwd=2, col="blue") axis(4) title("WA 7-day (rolling) averages") legend("topleft", c("# of tests (left)", "% positive (right)"), lwd=c(1,2), col=c("black", "blue"))
reg = unique(world$region[str_detect(world$region, "Washington US")]) reg <- reg[-1*(40:42)] for(i in reg){ if(max(subset(world, region==i)$positive, na.rm=TRUE)<100) next p <- my_plot(world, i) + xlim(as.Date("2020-03-01"), Sys.Date()) if(!is.null(p)) plot(p) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.