Browse Source

fix broken url and add case count label

master
William Davis 10 months ago
parent
commit
50d19f4c3a
  1. 28
      cases.csv
  2. 5
      script.r
  3. 2
      update_data.py

28
cases.csv

@ -206,3 +206,31 @@ day,cases,deaths
220,181787,5067
221,183624,5075
222,185639,5083
223,188005,5149
224,190430,5161
225,192948,5184
226,195806,5206
227,198115,5206
228,200231,5217
229,202740,5239
230,205347,5256
231,208937,5275
232,212782,5291
233,215697,5301
234,219000,5303
235,221909,5340
236,226138,5373
237,230209,5428
238,235170,5461
239,240178,5494
240,245727,5506
241,250268,5517
242,254974,5524
243,261482,5547
244,267356,5623
245,274457,5658
246,282528,5700
247,290243,5714
248,298096,5722
249,305364,5742
250,430093,6548

Can't render this file because it has a wrong number of fields in line 149.

5
script.r

@ -3,8 +3,11 @@ a = read.csv("cases.csv")
cases = data.frame("day" = a$day, "number" = a$cases, "type" = "cases")
deaths = data.frame("day" = a$day, "number" = a$deaths, "type" = "deaths")
data = rbind(cases,deaths)
last <- tail(cases,1)
ggplot(data, aes(x = day, y = number)) +
geom_line(aes(color=type)) +
# geom_point(color='royalblue') +
geom_point(color='royalblue') +
geom_point(data=last,color='red') +
geom_text(data=last, aes(x = day - 20, y = number, label = number)) +
ggtitle("Ohio COVID19 cases and deaths since mid March 2019")

2
update_data.py

@ -3,7 +3,7 @@ import os
import requests
def download():
url = "https://coronavirus.ohio.gov/static/COVIDSummaryData.csv"
url = "https://coronavirus.ohio.gov/static/dashboards/COVIDSummaryData.csv"
r = requests.get(url)
with open('COVIDdata.csv', 'wb') as f:

Loading…
Cancel
Save