-
-
Save mbauman/934d22b808b9fdf97848e63a31c24789 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import HTTP, CSV | |
using Plots, DataFrames | |
df = CSV.read(IOBuffer(String(HTTP.get("https://covid.ourworldindata.org/data/total_cases.csv").body)), normalizenames=true) | |
function doit(df, countries, alignment) | |
plot(legend=:topleft) | |
for country in countries | |
c = df[:, Symbol(country)] | |
plot!(df.date .- df.date[findfirst(coalesce.(c,0) .>= alignment)], c, label=string(country), yaxis=:log) | |
end | |
xlabel!("Days after $alignment cases") | |
xlims!(-1, last(xlims())) | |
ylims!(alignment*.9, last(ylims())) | |
end | |
doit(df, [:Italy, :United_States, :United_Kingdom, :China], 100) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Absolutely. Consider it MIT licensed.
import
instead of using because those packages largely rely on API style likeCSV.read
anyhow andHTTP
exports astack
that conflicts withDataframes
(I was playing with the JHU dataset, too, which requires some munging).