install.packages("readxl") library("readxl") par(mar=c(5, 4, 4, 2) + 0.1) setwd("C:/") # set your working directory ### Repeated y axis labels lab.infections = "Number of new infections per day\n" lab.cc = "Demand for critical care\n" lab.totalInf = "Total COVID-19 infections \nbetween August 15 and December 31\n" lab.totalDeath = "Total COVID-19 deaths \nbetween August 15 and December 31\n" lab.cumulDeath = "Cumulative number of COVID-19 deaths\n" ### Repeated y axis information colors6 = c("black", "black", "black", "grey60", "grey60", "grey60") lty6 = c(1, 2, 3, 1, 2, 3) max.inf = 250 inf.list = seq(0,max.inf, by=50) max.cc = 80 cc.list = seq(0,max.cc, by=10) max.cumulDeath = 150 death.list = seq(0,max.cumulDeath, by=25) death.labels = c("0", "25", "50", "75", "100", "125", "150") max.cumulInf = 15000 cumulInf.list = seq(0,max.cumulInf, by=2500) ### Repeated legends legendLabels = c("Without university students", "Base case: Students immediately reduce contacts by 40% (14.1 contacts/day)", "Students double contacts with other students for one week (total of 37.9 contacts/day), \nthen reduce to 14.1 contacts/day", "Students have 23.7 contacts/day for two weeks, followed by 14.1 contacts/day", "Students double contacts with other students for two weeks (37.9 contacts/day), \nthen reduce to 14.1 contacts/day", "Students have 23.7 contacts/day for three weeks, followed by 14.1 contacts/day" ) legendBar = c("University student population", "Incremental in general population and LTC attributable to university student arrival", "General population and LTC without arrival of university student population") legendLabels2 = c("Without university students", "Symptom-based surveillance & contact tracing", "One-time testing of all university students 3-weeks after students arrive", "Routine testing of university students every 5 days") legend.Appx1 = c("75", "50", "40 (Base case)", "25") legend.Appx2 = c("30%", "35%", "40% (Base case)", "45%", "50%") cumulInf.labels = c("0", "2,500", "5,000", "7,500", "10,000", "12,500", "15,000") Names.2C = c("Immediate\n40% reduction\nin contacts", "1 week of\n2.0x contacts\n", "2 week delay to\nreduce contacts\n", "2 weeks of\n1.5x contacts\n", "2 weeks of\n2.0x contacts\n", "3 week delay to\nreduce contacts\n", "3 weeks of\n1.5x contacts\n" ) Names.3A = c("Symptomatic\nSurveillance &\nContact Tracing", "+ Test once\n3-weeks after\nstudents arrive", "+ Test every\n28 days\n", "+ Test every\n14 days\n", "+ Test every\n7 days\n", "+ Test every\n5 days\n", "+ Test every\n3 days\n" ) Names.11 = c("Base case\n\n", paste(intToUtf8(8595),"initial infected\npopulation\n(25)"), paste(intToUtf8(8593),"initial infected\npopulation\n(50)"), paste(intToUtf8(8593),intToUtf8(8593),"initial\nparticipation\nin SD (50%)"), paste(intToUtf8(8593), "initial\nparticipation\nin SD (45%)"), paste(intToUtf8(8595),"initial\nparticipation\nin SD (35%)"), paste(intToUtf8(8595),intToUtf8(8595),"initial\nparticipation\nin SD (30%)")) Names.10 = c("Base case\n\n", "30% reduction\nin contacts\n", "35% reduction\nin contacts\n", "45% reduction\nin contacts\n", "50% reduction\nin contacts\n", "45% mask\nwearing\n", "65% mask\nwearing\n", "65% mask wearing\n+ 50% reduction\nin contacts") ### FIGURE 2A Fig2A <- read_excel("PlosOneFigureInputs.xlsx", sheet = "Fig 2A") LineData <- Fig2A[1:139,] tiff("Fig2A.tif", units="cm", height=14, width=18.5, res=600, compression = "lzw") par(oma=c(0,0,0,0), cex.axis=0.9, font.lab=2, cex.lab=0.9) par(mar=c(4, 6, 1, 2) + 0.1 ) par(xpd = T, mar = par()$mar + c(0,0,8,0)) plot(LineData$Day, LineData$NoStudents, type = "l", col="black", lty=1, lwd=2, ylab=lab.infections, xlab="Time", font.lab=2, yaxt="n", xaxt="n", xlim=c(0,138), xaxs="i", ylim=c(0,max.inf), yaxs="i") lines(LineData$Day, LineData$Stu_BC, type = "l", col="black", lty=2, lwd=2) lines(LineData$Day, LineData$Stu_1wk2x, type = "l", col="black", lty=3, lwd=2) lines(LineData$Day, LineData$Stu_2wk, type = "l", col="grey60", lty=1, lwd=2) lines(LineData$Day, LineData$Stu_2wk2x, type = "l", col="grey60", lty=2, lwd=2) lines(LineData$Day, LineData$Stu_3wk, type = "l", col="grey60", lty=3, lwd=2) axis(2, las=1, at=inf.list) axis(1, las=1, at=c(0, 17, 47, 78, 108, 138), labels=c("Aug 15", "Sept 1", "Oct 1", "Nov 1", "Dec 1", "Dec 31")) legend(0, 410, y.intersp = 1.1, legendLabels, col = colors6, lty=lty6, lwd=1.5, bg = NA, bty="n", cex=0.8) dev.off() ### FIGURE 2B Fig2B <- read_excel("PlosOneFigureInputs.xlsx", sheet = "Fig 2B") LineData <- Fig2B[1:139,] tiff("Fig2B.tif", units="cm", height=10, width=18.5, res=600, compression = "lzw") par(oma=c(0,0,0,0), cex.axis=0.9, font.lab=2, cex.lab=0.9) par(mar=c(4, 6, 1, 2) + 0.1 ) plot(LineData$Day, LineData$NoStudents, type = "l", col="black", lty=1, lwd=2, ylab=lab.cc, xlab="Time", font.lab=2, yaxt="n", xaxt="n", xlim=c(0,138), xaxs="i", ylim=c(0,max.cc), yaxs="i") lines(LineData$Day, LineData$Stu_BC, type = "l", col="black", lty=2, lwd=2) lines(LineData$Day, LineData$Stu_1wk2x, type = "l", col="black", lty=3, lwd=2) lines(LineData$Day, LineData$Stu_2wk, type = "l", col="grey60", lty=1, lwd=2) lines(LineData$Day, LineData$Stu_2wk2x, type = "l", col="grey60", lty=2, lwd=2) lines(LineData$Day, LineData$Stu_3wk, type = "l", col="grey60", lty=3, lwd=2) ## horiz line lines(seq(0,138, by=1), rep(30, length=139), type = "l", col="grey80", lty=5, lwd=.75) ## label the link text(35, 35, cex=0.75, "COVID-19 utilization of critical care affects \nability to provide elective surgeries.") axis(2, las=1, at=cc.list) axis(1, las=1, at=c(0, 17, 47, 78, 108, 138), labels=c("Aug 15", "Sept 1", "Oct 1", "Nov 1", "Dec 1", "Dec 31")) dev.off() ### FIGURE 2C Fig2C <- read_excel("PlosOneFigureInputs.xlsx", sheet = "Fig 2C") BarData <- as.matrix(Fig2C[, -1]) BarDiffs <- BarData BarDiffs[2, ] <- BarData[2, ] - BarData[1, ] BarDiffs[3, ] <- BarData[3, ] - BarData[2, ] Change = (BarData[3, ] - BarData[1, ])/BarData[1, ] tiff("Fig2C.tif", units="cm", height=10, width=18.5, res=600, compression = "lzw") par(oma=c(0,0,0,0), cex.axis=0.9, font.lab=2, cex.lab=0.9) par(mar=c(4, 6, 1, 2) + 0.1 ) # default border settings are mar=c(5,4,4,2) par(xpd = T, mar = par()$mar + c(0,0,0,0)) barplot(as.matrix(BarDiffs), space=rep(1.5, length=7), ylab=lab.totalInf, ylim=c(0,max.cumulInf), yaxt="n", cex.names = 0.62, border="black",col=c("black","grey50","grey80"), yaxs="i", names.arg=Names.2C) axis(2, las=1, at=cumulInf.list, labels=cumulInf.labels) text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0), BarData[1, ]/2, cex=0.6, format(round(BarDiffs[1, ]), big.mark=","), col="white") text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0), (BarData[2, ] - BarData[1, ])/2 +BarData[1, ], cex=0.6, format(round(BarDiffs[2, ]), big.mark=","), col="white") text(c(1.9, 4.5, 7.0, 9.5, 12, 14.5, 17.0), (BarData[3, ] - BarData[2, ])/2 +BarData[2, ], cex=0.6, format(round(BarDiffs[3, ]), big.mark=","), col="black") arrows(c(2.65, 5.15, 7.65, 10.15, 12.65, 15.15, 17.65), BarData[1, ], c(2.65, 5.15, 7.65, 10.15, 12.65, 15.15, 17.65), BarData[3, ], code=3, angle=90, length=0.025) text(c(2.65, 5.15, 7.65, 10.15, 12.65, 15.15, 17.65)+0.4, (BarData[3, ] - BarData[1, ])/2 + BarData[1, ], cex=0.5, format(paste(round(Change, digits=2)*100, "%", sep="") ), col="black") legend("topleft", y.intersp = 1.1, legend=legendBar, fill = c("grey80","grey50","black"), bg = NA, bty="n", cex=0.75) dev.off() ### FIGURE 3A Fig3A <- read_excel("PlosOneFigureInputs.xlsx", sheet = "Fig 3A") BarData <- as.matrix(Fig3A[, -1]) BarDiffs <- BarData BarDiffs[2, ] <- BarData[2, ] - BarData[1, ] BarDiffs[3, ] <- BarData[3, ] - BarData[2, ] Change = (BarData[3, ] - BarData[1, ])/BarData[1, ] tiff("Fig3A.tif", units="cm", height=10, width=18.5, res=600, compression = "lzw") par(oma=c(0,0,0,0), cex.axis=0.9, font.lab=2, cex.lab=0.9) par(mar=c(4, 6, 1, 2) + 0.1 ) par(xpd = T, mar = par()$mar + c(0,0,0,0)) barplot(as.matrix(BarDiffs), space=rep(1.5, length=7), ylab=lab.totalInf, ylim=c(0,max.cumulInf), yaxt="n", cex.names = 0.62, border="black",col=c("black","grey50","grey80"), yaxs="i", names.arg=Names.3A) axis(2, las=1, at=cumulInf.list, labels=cumulInf.labels) text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0), BarData[1, ]/2, cex=0.6, format(round(BarDiffs[1, ]), big.mark=","), col="white") text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0), (BarData[2, ] - BarData[1, ])/2 +BarData[1, ], cex=0.6, format(round(BarDiffs[2, ]), big.mark=","), col="white") text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0), (BarData[3, ] - BarData[2, ])/2 +BarData[2, ], cex=0.6, format(round(BarDiffs[3, ]), big.mark=","), col="black") arrows(c(2.65, 5.15, 7.65, 10.15, 12.65, 15.15, 17.65), BarData[1, ], c(2.65, 5.15, 7.65, 10.15, 12.65, 15.15, 17.65), BarData[3, ], code=3, angle=90, length=0.025) text(c(2.65, 5.15, 7.65, 10.15, 12.65, 15.15, 17.65)+0.4, (BarData[3, ] - BarData[1, ])/2 + BarData[1, ], cex=0.5, format(paste(round(Change, digits=2)*100, "%", sep="") ), col="black") legend("topleft", y.intersp = 1.1, legend=legendBar, fill = c("grey80","grey50","black"), bg = NA, bty="n", cex=0.75) dev.off() ### FIGURE 3B Fig3B <- read_excel("PlosOneFigureInputs.xlsx", sheet = "Fig 3B") BarData <- as.matrix(Fig3B[, -1]) BarDiffs <- BarData BarDiffs[2, ] <- BarData[2, ] - BarData[1, ] BarDiffs[3, ] <- BarData[3, ] - BarData[2, ] Change = (BarData[3, ] - BarData[1, ])/BarData[1, ] tiff("Fig3B.tif", units="cm", height=10, width=18.5, res=600, compression = "lzw") par(oma=c(0,0,0,0), cex.axis=0.9, font.lab=2, cex.lab=0.9) par(mar=c(4, 6, 1, 2) + 0.1 ) par(xpd = T, mar = par()$mar + c(0,0,0,0)) barplot(as.matrix(BarDiffs), space=rep(1.5, length=7), ylab=lab.totalInf, ylim=c(0,max.cumulInf), yaxt="n", cex.names = 0.62, border="black",col=c("black","grey50","grey80"), yaxs="i", names.arg=Names.3A) axis(2, las=1, at=cumulInf.list, labels=cumulInf.labels) text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0), BarData[1, ]/2, cex=0.6, format(round(BarDiffs[1, ]), big.mark=","), col="white") text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0), (BarData[2, ] - BarData[1, ])/2 +BarData[1, ], cex=0.6, format(round(BarDiffs[2, ]), big.mark=","), col="white") text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0)-c(0, 0, 0, 0, 0, 0, 0.08), (BarData[3, ] - BarData[2, ])/2 +BarData[2, ], cex=0.6, format(round(BarDiffs[3, ]), big.mark=","), col="black") arrows(c(2.65, 5.15, 7.65, 10.15, 12.65, 15.15, 17.65), BarData[1, ], c(2.65, 5.15, 7.65, 10.15, 12.65, 15.15, 17.65), BarData[3, ], code=3, angle=90, length=0.025) text(c(2.65, 5.15, 7.65, 10.15, 12.65, 15.15, 17.65)+0.4, (BarData[3, ] - BarData[1, ])/2 + BarData[1, ], cex=0.5, format(paste(round(Change, digits=2)*100, "%", sep="") ), col="black") dev.off() ### FIGURE 3C Fig3C <- read_excel("PlosOneFigureInputs.xlsx", sheet = "Fig 3C") BarData <- as.matrix(Fig3C[, -1]) BarDiffs <- BarData BarDiffs[2, ] <- BarData[2, ] - BarData[1, ] BarDiffs[3, ] <- BarData[3, ] - BarData[2, ] Change = (BarData[3, ] - BarData[1, ])/BarData[1, ] tiff("Fig3C.tif", units="cm", height=10, width=18.5, res=600, compression = "lzw") par(oma=c(0,0,0,0), cex.axis=0.9, font.lab=2, cex.lab=0.9) par(mar=c(4, 6, 1, 2) + 0.1 ) par(xpd = T, mar = par()$mar + c(0,0,0,0)) barplot(as.matrix(BarDiffs), space=rep(1.5, length=7), ylab=lab.totalInf, ylim=c(0,max.cumulInf), yaxt="n", cex.names = 0.62, border="black",col=c("black","grey50","grey80"), yaxs="i", names.arg=Names.3A) axis(2, las=1, at=cumulInf.list, labels=cumulInf.labels) text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0), BarData[1, ]/2, cex=0.6, format(round(BarDiffs[1, ]), big.mark=","), col="white") text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0), (BarData[2, ] - BarData[1, ])/2 +BarData[1, ], cex=0.6, format(round(BarDiffs[2, ]), big.mark=","), col="white") text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0)-c(0, 0, 0, 0, 0, 0, 0.08), (BarData[3, ] - BarData[2, ])/2 +BarData[2, ], cex=0.6, format(round(BarDiffs[3, ]), big.mark=","), col="black") arrows(c(2.65, 5.15, 7.65, 10.15, 12.65, 15.15, 17.65), BarData[1, ], c(2.65, 5.15, 7.65, 10.15, 12.65, 15.15, 17.65), BarData[3, ], code=3, angle=90, length=0.025) text(c(2.67, 5.15, 7.65, 10.15, 12.65, 15.15, 17.65)+0.45, (BarData[3, ] - BarData[1, ])/2 + BarData[1, ], cex=0.5, format(paste(round(Change, digits=2)*100, "%", sep="") ), col="black") dev.off() ### FIGURE 5A Fig5A <- read_excel("PlosOneFigureInputs.xlsx", sheet = "Appx Fig 5A") LineData <- Fig5A[1:139,] tiff("Fig5A.tif", units="cm", height=10, width=18.5, res=600, compression = "lzw") par(oma=c(0,0,0,0), cex.axis=0.9, font.lab=2, cex.lab=0.9) par(mar=c(4, 6, 1, 2) + 0.1 ) plot(LineData$Day, LineData$Inf40, type = "l", col="black", lty=1, lwd=2, ylab=lab.infections, xlab="Time", font.lab=2, yaxt="n", xaxt="n", xlim=c(0,138), xaxs="i", ylim=c(0,max.inf), yaxs="i") lines(LineData$Day, LineData$Inf25, type = "l", col="black", lty=2, lwd=2) lines(LineData$Day, LineData$Inf50, type = "l", col="grey60", lty=1, lwd=2) lines(LineData$Day, LineData$Inf75, type = "l", col="grey60", lty=2, lwd=2) axis(2, las=1, at=inf.list) axis(1, las=1, at=c(0, 17, 47, 78, 108, 138), labels=c("Aug 15", "Sept 1", "Oct 1", "Nov 1", "Dec 1", "Dec 31")) legend(5, 0.9*max.inf, y.intersp = 1.1, legend.Appx1, col = c("grey60", "grey60", "black", "black"), lty=c(2,1,1,2), lwd=1.5, bg = NA, bty="n", cex=0.8, title="Number of infections\nin the community on August 15") dev.off() ### FIGURE 5B Fig5B <- read_excel("PlosOneFigureInputs.xlsx", sheet = "Appx Fig 5B") LineData <- Fig5B[1:139,] tiff("Fig5B.tif", units="cm", height=10, width=18.5, res=600, compression = "lzw") par(oma=c(0,0,0,0), cex.axis=0.9, font.lab=2, cex.lab=0.9) par(mar=c(4, 6, 1, 2) + 0.1 ) plot(LineData$Day, LineData$SD40, type = "l", col="black", lty=1, lwd=2, ylab=lab.infections, xlab="Time", font.lab=2, yaxt="n", xaxt="n", xlim=c(0,138), xaxs="i", ylim=c(0,max.inf), yaxs="i") lines(LineData$Day, LineData$SD50, type = "l", col="black", lty=3, lwd=2) lines(LineData$Day, LineData$SD45, type = "l", col="black", lty=2, lwd=2) lines(LineData$Day, LineData$SD35, type = "l", col="grey60", lty=2, lwd=2) lines(LineData$Day, LineData$SD30, type = "l", col="grey60", lty=3, lwd=2) axis(2, las=1, at=inf.list) axis(1, las=1, at=c(0, 17, 47, 78, 108, 138), labels=c("Aug 15", "Sept 1", "Oct 1", "Nov 1", "Dec 1", "Dec 31")) legend(5, 0.9*max.inf, y.intersp = 1.1, legend.Appx2, col = c("grey60", "grey60", "black", "black", "black"), lty=c(3, 2,1,2,3), lwd=1.5, bg = NA, bty="n", cex=0.8, title="Proportion of the population participating\nin high-intensity physical distancing on August 15") dev.off() ### FIGURE 6A Fig6A <- read_excel("PlosOneFigureInputs.xlsx", sheet = "Appx Fig 6A") LineData <- Fig6A[1:139,] tiff("Fig6A.tif", units="cm", height=10, width=18.5, res=600, compression = "lzw") par(oma=c(0,0,0,0), cex.axis=0.9, font.lab=2, cex.lab=0.9) par(mar=c(4, 6, 1, 2) + 0.1 ) plot(LineData$Day, LineData$Inf40, type = "l", col="black", lty=1, lwd=2, ylab=lab.cc, xlab="Time", font.lab=2, yaxt="n", xaxt="n", xlim=c(0,138), xaxs="i", ylim=c(0,max.cc), yaxs="i") lines(LineData$Day, LineData$Inf25, type = "l", col="black", lty=2, lwd=2) lines(LineData$Day, LineData$Inf50, type = "l", col="grey60", lty=1, lwd=2) lines(LineData$Day, LineData$Inf75, type = "l", col="grey60", lty=2, lwd=2) axis(2, las=1, at=cc.list) axis(1, las=1, at=c(0, 17, 47, 78, 108, 138), labels=c("Aug 15", "Sept 1", "Oct 1", "Nov 1", "Dec 1", "Dec 31")) legend(5, 0.9*max.cc, y.intersp = 1.1, legend.Appx1, col = c("grey60", "grey60", "black", "black"), lty=c(2,1,1,2), lwd=1.5, bg = NA, bty="n", cex=0.8, title="Number of infections\nin the community on August 15") dev.off() ### FIGURE 6B Fig6B <- read_excel("PlosOneFigureInputs.xlsx", sheet = "Appx Fig 6B") LineData <- Fig6B[1:139,] tiff("Fig6B.tif", units="cm", height=10, width=18.5, res=600, compression = "lzw") par(oma=c(0,0,0,0), cex.axis=0.9, font.lab=2, cex.lab=0.9) par(mar=c(4, 6, 1, 2) + 0.1 ) plot(LineData$Day, LineData$SD40, type = "l", col="black", lty=1, lwd=2, ylab=lab.cc, xlab="Time", font.lab=2, yaxt="n", xaxt="n", xlim=c(0,138), xaxs="i", ylim=c(0,max.cc), yaxs="i") lines(LineData$Day, LineData$SD50, type = "l", col="black", lty=3, lwd=2) lines(LineData$Day, LineData$SD45, type = "l", col="black", lty=2, lwd=2) lines(LineData$Day, LineData$SD35, type = "l", col="grey60", lty=2, lwd=2) lines(LineData$Day, LineData$SD30, type = "l", col="grey60", lty=3, lwd=2) axis(2, las=1, at=cc.list) axis(1, las=1, at=c(0, 17, 47, 78, 108, 138), labels=c("Aug 15", "Sept 1", "Oct 1", "Nov 1", "Dec 1", "Dec 31")) legend(5, 0.9*max.cc, y.intersp = 1.1, legend.Appx2, col = c("grey60", "grey60", "black", "black", "black"), lty=c(3, 2,1,2,3), lwd=1.5, bg = NA, bty="n", cex=0.8, title="Proportion of the population participating\nin high-intensity physical distancing on August 15") dev.off() ### FIGURE 7A Fig7A <- read_excel("PlosOneFigureInputs.xlsx", sheet = "Appx Fig 7A") LineData <- Fig7A[1:139,] tiff("Fig7A.tif", units="cm", height=10, width=18.5, res=600, compression = "lzw") par(oma=c(0,0,0,0), cex.axis=0.9, font.lab=2, cex.lab=0.9) par(mar=c(4, 6, 1, 2) + 0.1 ) plot(LineData$Day, LineData$Inf40, type = "l", col="black", lty=1, lwd=2, ylab=lab.cumulDeath, xlab="Time", font.lab=2, yaxt="n", xaxt="n", xlim=c(0,138), xaxs="i", ylim=c(0,max.cumulDeath), yaxs="i") lines(LineData$Day, LineData$Inf25, type = "l", col="black", lty=2, lwd=2) lines(LineData$Day, LineData$Inf50, type = "l", col="grey60", lty=1, lwd=2) lines(LineData$Day, LineData$Inf75, type = "l", col="grey60", lty=2, lwd=2) axis(2, las=1, at=death.list) axis(1, las=1, at=c(0, 17, 47, 78, 108, 138), labels=c("Aug 15", "Sept 1", "Oct 1", "Nov 1", "Dec 1", "Dec 31")) legend(5, 0.9*max.cumulDeath, y.intersp = 1.1, legend.Appx1, col = c("grey60", "grey60", "black", "black"), lty=c(2,1,1,2), lwd=1.5, bg = NA, bty="n", cex=0.8, title="Number of infections\nin the community on August 15") dev.off() ### FIGURE 7B Fig7B <- read_excel("PlosOneFigureInputs.xlsx", sheet = "Appx Fig 7B") LineData <- Fig7B[1:139,] tiff("Fig7B.tif", units="cm", height=10, width=18.5, res=600, compression = "lzw") par(oma=c(0,0,0,0), cex.axis=0.9, font.lab=2, cex.lab=0.9) par(mar=c(4, 6, 1, 2) + 0.1 ) plot(LineData$Day, LineData$SD40, type = "l", col="black", lty=1, lwd=2, ylab=lab.cumulDeath, xlab="Time", font.lab=2, yaxt="n", xaxt="n", xlim=c(0,138), xaxs="i", ylim=c(0,max.cumulDeath), yaxs="i") lines(LineData$Day, LineData$SD50, type = "l", col="black", lty=3, lwd=2) lines(LineData$Day, LineData$SD45, type = "l", col="black", lty=2, lwd=2) lines(LineData$Day, LineData$SD35, type = "l", col="grey60", lty=2, lwd=2) lines(LineData$Day, LineData$SD30, type = "l", col="grey60", lty=3, lwd=2) axis(2, las=1, at=death.list) axis(1, las=1, at=c(0, 17, 47, 78, 108, 138), labels=c("Aug 15", "Sept 1", "Oct 1", "Nov 1", "Dec 1", "Dec 31")) legend(5, 0.9*max.cumulDeath, y.intersp = 1.1, legend.Appx2, col = c("grey60", "grey60", "black", "black", "black"), lty=c(3, 2,1,2,3), lwd=1.5, bg = NA, bty="n", cex=0.8, title="Proportion of the population participating\nin high-intensity physical distancing on August 15") dev.off() ### FIGURE 8A Fig8A <- read_excel("PlosOneFigureInputs.xlsx", sheet = "Appx Fig 8A") LineData <- Fig8A[1:139,] tiff("Fig8A.tif", units="cm", height=14, width=18.5, res=600, compression = "lzw") par(oma=c(0,0,0,0), cex.axis=0.9, font.lab=2, cex.lab=0.9) par(mar=c(4, 6, 1, 2) + 0.1 ) # default border settings are mar=c(5,4,4,2) par(xpd = T, mar = par()$mar + c(0,0,8,0)) plot(LineData$Day, LineData$NoStudents, type = "l", col="black", lty=1, lwd=2, ylab=lab.cumulDeath, xlab="Time", font.lab=2, yaxt="n", xaxt="n", xlim=c(0,138), xaxs="i", ylim=c(0,max.cumulDeath), yaxs="i") lines(LineData$Day, LineData$Stu_BC, type = "l", col="black", lty=2, lwd=2) lines(LineData$Day, LineData$Stu_1wk2x, type = "l", col="black", lty=3, lwd=2) lines(LineData$Day, LineData$Stu_2wk, type = "l", col="grey60", lty=1, lwd=2) lines(LineData$Day, LineData$Stu_2wk2x, type = "l", col="grey60", lty=2, lwd=2) lines(LineData$Day, LineData$Stu_3wk, type = "l", col="grey60", lty=3, lwd=2) axis(2, las=1, at=death.list) axis(1, las=1, at=c(0, 17, 47, 78, 108, 138), labels=c("Aug 15", "Sept 1", "Oct 1", "Nov 1", "Dec 1", "Dec 31")) legend(0, 250, y.intersp = 1.1, legendLabels, col = colors6, lty=lty6, lwd=1.5, bg = NA, bty="n", cex=0.8) dev.off() ### FIGURE 8B Fig8B <- read_excel("PlosOneFigureInputs.xlsx", sheet = "Appx Fig 8B") BarData <- as.matrix(Fig8B[, -1]) BarDiffs <- BarData BarDiffs[2, ] <- BarData[2, ] - BarData[1, ] BarDiffs[3, ] <- BarData[3, ] - BarData[2, ] Change = (BarData[3, ] - BarData[1, ])/BarData[1, ] tiff("Fig8B.tif", units="cm", height=10, width=18.5, res=600, compression = "lzw") par(oma=c(0,0,0,0), cex.axis=0.9, font.lab=2, cex.lab=0.9) par(mar=c(4, 6, 1, 2) + 0.1 ) par(xpd = T, mar = par()$mar + c(0,0,0,0)) barplot(as.matrix(BarDiffs), space=rep(1.5, length=7), ylab=lab.totalDeath, ylim=c(0,max.cumulDeath), yaxt="n", cex.names = 0.62, border="black",col=c("black","grey50","grey80"), yaxs="i", names.arg=Names.2C) axis(2, las=1, at=death.list, labels=death.labels) text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0), BarData[1, ]/2, cex=0.6, format(round(BarDiffs[1, ],1), big.mark=","), col="white") text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0), (BarData[2, ] - BarData[1, ])/2 +BarData[1, ], cex=0.6, format(round(BarDiffs[2, ],1), big.mark=","), col="white") text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0), BarData[3, ]+3 , cex=0.6, format(round(BarDiffs[3, ],1), big.mark=","), col="black") arrows(c(2.65, 5.15, 7.65, 10.15, 12.65, 15.15, 17.65), BarData[1, ], c(2.65, 5.15, 7.65, 10.15, 12.65, 15.15, 17.65), BarData[3, ], code=3, angle=90, length=0.025) text(c(2.67, 5.15, 7.65, 10.15, 12.65, 15.15, 17.65)+0.45, (BarData[3, ] - BarData[1, ])/2 + BarData[1, ], cex=0.5, format(paste(round(Change, digits=2)*100, "%", sep="") ), col="black") legend("topleft", inset=c(0,-0.035), y.intersp = 1.1, legend=legendBar, fill = c("grey80","grey50","black"), bg = NA, bty="n", cex=0.75) dev.off() ### FIGURE 9A Fig9A <- read_excel("PlosOneFigureInputs.xlsx", sheet = "Appx Fig 9A") LineData <- Fig9A[1:139,] tiff("Fig9A.tif", units="cm", height=12, width=18.5, res=600, compression = "lzw") par(oma=c(0,0,0,0), cex.axis=0.9, font.lab=2, cex.lab=0.9) par(mar=c(4, 6, 1, 2) + 0.1 ) par(xpd = T, mar = par()$mar + c(0,0,4,0)) plot(LineData$Day, LineData$Stu_2wk2x_SS, type = "l", col="grey60", lty=1, lwd=2, ylab=paste(lab.infections, "in the general population\n"), xlab="Time", font.lab=2, yaxt="n", xaxt="n", xlim=c(0,138), xaxs="i", ylim=c(0,200), yaxs="i") lines(LineData$Day, LineData$NoStudents, type = "l", col="black", lty=1, lwd=2) lines(LineData$Day, LineData$Stu_2wk2x_5d, type = "l", col="grey60", lty=2, lwd=2) lines(LineData$Day, LineData$Stu_2wk2x_once, type = "l", col="grey60", lty=3, lwd=2) axis(2, las=1, at=seq(0,200, by=20)) axis(1, las=1, at=c(0, 17, 47, 78, 108, 138), labels=c("Aug 15", "Sept 1", "Oct 1", "Nov 1", "Dec 1", "Dec 31")) legend(0, 260, y.intersp = 1.1, legendLabels2, col = c("black", "grey60", "grey60", "grey60"), lty=c(1, 1, 3, 2), lwd=1.5, bg = NA, bty="n", cex=0.8) dev.off() ### FIGURE 9B Fig9B <- read_excel("PlosOneFigureInputs.xlsx", sheet = "Appx Fig 9B") LineData <- Fig9B[1:139,] tiff("Fig9B.tif", units="cm", height=10, width=18.5, res=600, compression = "lzw") par(oma=c(0,0,0,0), cex.axis=0.9, font.lab=2, cex.lab=0.9) par(mar=c(4, 6, 1, 2) + 0.1 ) plot(LineData$Day, LineData$Stu_2wk2x_SS, type = "l", col="grey60", lty=1, lwd=2, ylab=paste(lab.infections, "in the student population\n"), xlab="Time", font.lab=2, yaxt="n", xaxt="n", xlim=c(0,138), xaxs="i", ylim=c(0,50), yaxs="i") lines(LineData$Day, LineData$Stu_2wk2x_5d, type = "l", col="grey60", lty=2, lwd=2) lines(LineData$Day, LineData$Stu_2wk2x_once, type = "l", col="grey60", lty=3, lwd=2) axis(2, las=1, at=seq(0,50, by=5)) axis(1, las=1, at=c(0, 17, 47, 78, 108, 138), labels=c("Aug 15", "Sept 1", "Oct 1", "Nov 1", "Dec 1", "Dec 31")) dev.off() ### FIGURE 10A Fig10A <- read_excel("PlosOneFigureInputs.xlsx", sheet = "Appx Fig 10A") BarData <- as.matrix(Fig10A[, -1]) BarDiffs <- BarData BarDiffs[2, ] <- BarData[2, ] - BarData[1, ] BarDiffs[3, ] <- BarData[3, ] - BarData[2, ] Change = (BarData[3, ] - BarData[1, ])/BarData[1, ] tiff("Fig10A.tif", units="cm", height=10, width=18.5, res=600, compression = "lzw") par(oma=c(0,0,0,0), cex.axis=0.9, font.lab=2, cex.lab=0.9) par(mar=c(4, 6, 1, 2) + 0.1 ) # default border settings are mar=c(5,4,4,2) par(xpd = T, mar = par()$mar + c(0,0,0,0)) barplot(as.matrix(BarDiffs), space=rep(1.5, length=8), ylab=lab.totalInf, ylim=c(0,max.cumulInf), yaxt="n", cex.names = 0.55, border="black",col=c("black","grey50","grey80"), yaxs="i", names.arg=Names.10) axis(2, las=1, at=cumulInf.list, labels=cumulInf.labels) text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0, 19.5), BarData[1, ]/2, cex=0.6, format(round(BarDiffs[1, ]), big.mark=","), col="white") text(c(2.0, 4.5, 7.0, 9.5, 12.1, 14.5, 17.0, 19.5)+c(0,0,0,0,-.1,0,0,0), (BarData[2, ] - BarData[1, ])/2 +BarData[1, ], cex=0.6, format(round(BarDiffs[2, ]), big.mark=","), col="white") text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0, 19.5)+c(0,0,0,-.06,-.05,0,-0.06,-.06), (BarData[3, ] - BarData[2, ])/2 +BarData[2, ] + c(0,0,0,710,580,0,0,550), cex=0.6, format(round(BarDiffs[3, ]), big.mark=","), col="black") arrows(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0, 19.5)+0.67, BarData[1, ], c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0, 19.5)+0.67, BarData[3, ], code=3, angle=90, length=0.025) text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0, 19.5)+0.67+0.45, (BarData[3, ] - BarData[1, ])/2 + BarData[1, ], cex=0.5, format(paste(round(Change, digits=2)*100, "%", sep="") ), col="black") legend("topleft", y.intersp = 1.1, legend=legendBar, fill = c("grey80","grey50","black"), bg = NA, bty="n", cex=0.75) dev.off() ### FIGURE 10B Fig10B <- read_excel("PlosOneFigureInputs.xlsx", sheet = "Appx Fig 10B") BarData <- as.matrix(Fig10B[, -1]) BarDiffs <- BarData BarDiffs[2, ] <- BarData[2, ] - BarData[1, ] BarDiffs[3, ] <- BarData[3, ] - BarData[2, ] Change = (BarData[3, ] - BarData[1, ])/BarData[1, ] tiff("Fig10B.tif", units="cm", height=10, width=18.5, res=600, compression = "lzw") par(oma=c(0,0,0,0), cex.axis=0.9, font.lab=2, cex.lab=0.9) par(mar=c(4, 6, 1, 2) + 0.1 ) par(xpd = T, mar = par()$mar + c(0,0,0,0)) barplot(as.matrix(BarDiffs), space=rep(1.5, length=8), ylab=lab.totalDeath, ylim=c(0,max.cumulDeath), yaxt="n", cex.names = 0.55, border="black",col=c("black","grey50","grey80"), yaxs="i", names.arg=Names.10) axis(2, las=1, at=death.list, labels=death.labels) text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0, 19.5), BarData[1, ]/2, cex=0.6, format(round(BarDiffs[1, ],1), big.mark=","), col="white") text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0, 19.5)+c(0,0,0,0,-.05,0,0,-.05), (BarData[2, ] - BarData[1, ])/2 +BarData[1, ], cex=0.6, format(round(BarDiffs[2, ],1), big.mark=","), col="white") text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0, 19.5)+c(0,0,0,0,0,0,0,0), BarData[3, ]+3, cex=0.6, format(round(BarDiffs[3, ],1), big.mark=","), col="black") arrows(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0, 19.5)+0.67, BarData[1, ], c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0, 19.5)+0.67, BarData[3, ], code=3, angle=90, length=0.025) text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0, 19.5)+0.67+0.45, (BarData[3, ] - BarData[1, ])/2 + BarData[1, ], cex=0.5, format(paste(round(Change, digits=2)*100, "%", sep="") ), col="black") dev.off() ### FIGURE 11A Fig11A <- read_excel("PlosOneFigureInputs.xlsx", sheet = "Appx Fig 11A") BarData <- as.matrix(Fig11A[, -1]) BarDiffs <- BarData BarDiffs[2, ] <- BarData[2, ] - BarData[1, ] BarDiffs[3, ] <- BarData[3, ] - BarData[2, ] Change = (BarData[3, ] - BarData[1, ])/BarData[1, ] tiff("Fig11A.tif", units="cm", height=10, width=18.5, res=600, compression = "lzw") par(oma=c(0,0,0,0), cex.axis=0.9, font.lab=2, cex.lab=0.9) par(mar=c(4, 6, 1, 2) + 0.1 ) # default border settings are mar=c(5,4,4,2) par(xpd = T, mar = par()$mar + c(0,0,0,0)) barplot(as.matrix(BarDiffs), space=rep(1.5, length=7), ylab=lab.totalInf, ylim=c(0,max.cumulInf), yaxt="n", cex.names = 0.62, border="black",col=c("black","grey50","grey80"), yaxs="i", names.arg=Names.11) axis(2, las=1, at=cumulInf.list, labels=cumulInf.labels) text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0)+c(0,0,0,-.08,0,0,0), BarData[1, ]/2, cex=0.6, format(round(BarDiffs[1, ]), big.mark=","), col="white") text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0)+c(0,0,0,-.08,0,0,0), (BarData[2, ] - BarData[1, ])/2 +BarData[1, ], cex=0.6, format(round(BarDiffs[2, ]), big.mark=","), col="white") text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0)+c(0,0,0,-.03,0,0,+0.05)-0.05, (BarData[3, ] - BarData[2, ])/2 +BarData[2, ] + c(0,0,0,550,0,0,0), cex=0.6, format(round(BarDiffs[3, ]), big.mark=","), col="black") arrows(c(2.65, 5.15, 7.65, 10.15, 12.65, 15.15, 17.65), BarData[1, ], c(2.65, 5.15, 7.65, 10.15, 12.65, 15.15, 17.65), BarData[3, ], code=3, angle=90, length=0.025) text(c(2.67, 5.15, 7.65, 10.15, 12.65, 15.15, 17.65)+0.45, (BarData[3, ] - BarData[1, ])/2 + BarData[1, ], cex=0.5, format(paste(round(Change, digits=2)*100, "%", sep="") ), col="black") legend("topleft", y.intersp = 1.1, legend=legendBar, fill = c("grey80","grey50","black"), bg = NA, bty="n", cex=0.75) dev.off() ### FIGURE 11B Fig11B <- read_excel("PlosOneFigureInputs.xlsx", sheet = "Appx Fig 11B") BarData <- as.matrix(Fig11B[, -1]) BarDiffs <- BarData BarDiffs[2, ] <- BarData[2, ] - BarData[1, ] BarDiffs[3, ] <- BarData[3, ] - BarData[2, ] Change = (BarData[3, ] - BarData[1, ])/BarData[1, ] tiff("Fig11B.tif", units="cm", height=10, width=18.5, res=600, compression = "lzw") par(oma=c(0,0,0,0), cex.axis=0.9, font.lab=2, cex.lab=0.9) par(mar=c(4, 6, 1, 2) + 0.1 ) par(xpd = T, mar = par()$mar + c(0,0,0,0)) barplot(as.matrix(BarDiffs), space=rep(1.5, length=7), ylab=lab.totalDeath, ylim=c(0,max.cumulDeath), yaxt="n", cex.names = 0.62, border="black",col=c("black","grey50","grey80"), yaxs="i", names.arg=Names.11) axis(2, las=1, at=death.list, labels=death.labels) text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0)+c(0,0,0,-.05,-.05,0,0), BarData[1, ]/2, cex=0.6, format(round(BarDiffs[1, ],1), big.mark=","), col="white") text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0)+c(0,0,0,-.02,-0.05,0,0), (BarData[2, ] - BarData[1, ])/2 +BarData[1, ], cex=0.6, format(round(BarDiffs[2, ],1), big.mark=","), col="white") text(c(2.0, 4.5, 7.0, 9.5, 12, 14.5, 17.0)+c(0,0,0,+.04,0,0,0), BarData[3, ]+4 , cex=0.6, format(round(BarDiffs[3, ],1), big.mark=","), col="black") arrows(c(2.65, 5.15, 7.65, 10.15, 12.65, 15.15, 17.65), BarData[1, ], c(2.65, 5.15, 7.65, 10.15, 12.65, 15.15, 17.65), BarData[3, ], code=3, angle=90, length=0.025) text(c(2.67, 5.15, 7.65, 10.15, 12.65, 15.15, 17.65)+0.45, (BarData[3, ] - BarData[1, ])/2 + BarData[1, ], cex=0.5, format(paste(round(Change, digits=2)*100, "%", sep="") ), col="black") dev.off() ### FIGURE 4 -- GOOGLE MOBILITY REPORT Fig4 <- read_excel("PlosOneFigureInputs.xlsx", sheet = "GoogleReport") ## Calculate centered moving average Fig4$Residential.Avg <- NA Fig4$Retail.Avg <- NA Fig4$Grocery.Avg <- NA Fig4$Transit.Avg <- NA Fig4$Workplaces.Avg <- NA Fig4$Parks.Avg <- NA for (i in c(5:202)){ Fig4$Residential.Avg[i] <- sum(Fig4$Residential[(i-3):(i+3)])/7 Fig4$Retail.Avg[i] <- sum(Fig4$Retail[(i-3):(i+3)])/7 Fig4$Grocery.Avg[i] <- sum(Fig4$Grocery[(i-3):(i+3)])/7 Fig4$Transit.Avg[i] <- sum(Fig4$Transit[(i-3):(i+3)])/7 Fig4$Workplaces.Avg[i] <- sum(Fig4$Workplaces[(i-3):(i+3)])/7 Fig4$Parks.Avg[i] <- sum(Fig4$Parks[(i-3):(i+3)])/7 } #View(Fig4) mobility.legend = c("Residential", "Grocery and pharmacy", "Retail and recreation", "Workplaces", "Transit stations") LineData <- Fig4 tiff("Fig4.tif", units="cm", height=10, width=18.5, res=600, compression = "lzw") par(oma=c(0,0,0,0), cex.axis=0.9, font.lab=2, cex.lab=0.9) par(mar=c(4, 6, 1, 2) + 0.1 ) plot(LineData$Row, LineData$Retail.Avg, type = "l", col="deepskyblue2", lty=1, lwd=2, ylab="Percent change compared to baseline\n", xlab="Time", font.lab=2, yaxt="n", xaxt="n", xlim=c(16,202), xaxs="i", ylim=c(-100,50), yaxs="i") lines(LineData$Row, LineData$Grocery.Avg, type = "l", col="darkgoldenrod1", lty=1, lwd=2) lines(LineData$Row, LineData$Transit.Avg, type = "l", col="forestgreen", lty=1, lwd=2) lines(LineData$Row, LineData$Workplaces.Avg, type = "l", col="firebrick1", lty=1, lwd=2) lines(LineData$Row, LineData$Residential.Avg, type = "l", col="darkblue", lty=1, lwd=2) axis(2, las=1, at=seq(-100,50, by=25)) axis(1, las=1, at=c(16, 47, 77, 108, 138, 169, 200), labels=c("Mar 1", "Apr 1", "May 1", " Jun 1", "Jul 1", "Aug 1", "Sept 1")) legend("bottomright", y.intersp = 1.1, mobility.legend, col = c("darkblue", "darkgoldenrod1", "deepskyblue2", "firebrick1", "forestgreen"), lty=1, lwd=1.5, bg = NA, bty="n", cex=0.75) ## horiz line lines(seq(0,220, by=1), rep(0, length=221), type = "l", col="black", lty=1, lwd=1) lines(c(47,47), c(-3,+3), type = "l", col="black", lty=1, lwd=1) lines(c(77,77), c(-3,+3), type = "l", col="black", lty=1, lwd=1) lines(c(108,108), c(-3,+3), type = "l", col="black", lty=1, lwd=1) lines(c(138,138), c(-3,+3), type = "l", col="black", lty=1, lwd=1) lines(c(169,169), c(-3,+3), type = "l", col="black", lty=1, lwd=1) lines(c(200,200), c(-3,+3), type = "l", col="black", lty=1, lwd=1) dev.off()