Skip to content
This repository was archived by the owner on Mar 25, 2021. It is now read-only.

Commit 6a37b7e

Browse files
authored
Merge pull request #35 from cmu-delphi/survey-2
Incorporate Ryan's plotting fixes
2 parents f17d9e3 + 6c051af commit 6a37b7e

File tree

7 files changed

+975
-957
lines changed

7 files changed

+975
-957
lines changed

content/post/2020-10-06-survey-wave-4.Rmd

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ library(gridExtra)
120120
start_day <- "2020-09-08"
121121
end_day <- "2020-10-07"
122122
123-
date_formatted <- format(as.Date(end_day), "%B %e, %Y")
123+
vec <- strsplit(format(as.Date(end_day), "%B %e %Y"), split = "\\s+")[[1]]
124+
date_formatted <- paste(paste(vec[1], vec[2]), vec[3], sep = ", ")
124125
plot_label <- labs(caption = "Data from Delphi COVIDcast, covidcast.cmu.edu")
125126
date_label <- labs(subtitle = date_formatted)
126127
grid_label <- textGrob("Data from Delphi COVIDcast, covidcast.cmu.edu",
@@ -190,15 +191,23 @@ joined_data %>%
190191
"Mask use: %{y:.0f}%<br>",
191192
"Cases per 100,000: %{x:.1f}"),
192193
showlegend = FALSE) %>%
193-
layout(xaxis = list(title = "New cases per 100,000 people (7-day average)"),
194-
yaxis = list(title = "% wearing masks most/all the time in public"),
195-
title = paste0("Current COVID case rates and mask usage, by state<br>",
196-
date_formatted),
197-
annotations = list(x = 1, y = 0,
198-
text = "Data from Delphi COVIDcast, covidcast.cmu.edu",
199-
showarrow = FALSE, xref = "paper", yref = "paper",
200-
xanchor = "right", yanchor = "auto",
201-
xshift = 0, yshift = 0),
194+
layout(xaxis = list(title = "New cases per 100,000 people (7-day average)",
195+
showline = TRUE, mirror = "ticks", zeroline = FALSE),
196+
yaxis = list(title = "% wearing masks most/all the time in public",
197+
showline = TRUE, mirror = "ticks", zeroline = FALSE),
198+
title = "Current COVID case rates and mask usage, by state",
199+
subtitle = date_formatted,
200+
annotations = list(
201+
list(x = 0.5, y = 1,
202+
text = date_formatted,
203+
showarrow = FALSE, xref = "paper", yref = "paper",
204+
xanchor = "center", yanchor = "auto",
205+
xshift = 0, yshift = 0),
206+
list(x = 1, y = 0,
207+
text = "Data from Delphi COVIDcast, covidcast.cmu.edu",
208+
showarrow = FALSE, xref = "paper", yref = "paper",
209+
xanchor = "right", yanchor = "auto",
210+
xshift = 0, yshift = 0)),
202211
dragmode = FALSE) %>%
203212
config(modeBarButtonsToRemove = c("zoom2d", "pan2d", "select2d", "lasso2d",
204213
"zoomIn2d", "zoomOut2d", "resetScale2d",

public/2020/10/12/new-and-improved-covid-symptom-survey-tracks-testing-and-mask-wearing/index.html

Lines changed: 20 additions & 11 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)