This is the number and 7 day average of COVID cases per day in CA.
fig1 <- plot_ly(data = covid_df) %>%
add_trace(x = ~date, y = ~cases, type = 'bar', name = 'Cases per day',
marker = list(color = 'rgb(187, 216, 228)'),
hoverinfo = "text",
text = ~paste(round(cases, 0), ' cases')) %>%
add_trace(x = ~date, y = ~case_roll, type = 'scatter', mode = 'lines', name = 'Average Cases',
line = list(color = '#345B6B'),
hoverinfo = "text",
text = ~paste(round(case_roll, 1), ' average cases')
) %>%
layout(legend = list(x = 0.1, y = 0.9))
fig1
This is the number of PCR tests per day for the State of CA.
fig2 <- plot_ly(data = covid_df) %>%
add_trace(x = ~date, y = ~total_tests, type = 'bar', name = 'Tests per day',
marker = list(color = 'rgb(245, 185, 73)'),
hoverinfo = "text",
text = ~paste(round(total_tests, 0), ' tests')) %>%
add_trace(x = ~date, y = ~test_roll, type = 'scatter', mode = 'lines', name = 'Average Tests',
line = list(color = '#345B6B'),
hoverinfo = "text",
text = ~paste(round(test_roll, 2), ' average tests')
) %>%
layout(legend = list(x = 0.1, y = 0.9))
fig2