Plotting daily death using Makie

Hello, I am plotting the daily new death per day. It should be a line, but it looks strange.

Here are my codes:

# read the data
covid_death = filter(row -> row.location == "Germany" && row.date >= Date(2020, 6, 1) && row.date <= Date(2021, 5, 31), 
CSV.read("..../owid-covid-data_casedeathoxfordindex.csv", DataFrame)) # 365×67 DataFrame

# plot the figure with grey background
f = Figure(backgroundcolor = RGBf(0.98, 0.98, 0.98), size = (1000, 900))

# Setting up GridLayouts
ga = f[1, 1] = GridLayout()
gb = f[2, 1] = GridLayout()
gc = f[3, 1] = GridLayout()

# Panel A
ax = Axis(ga[1,1])
days = length(covid_death.date)
lines!(ax, 1:days, covid_death.new_deaths_per_million,
ylabel = "new_deaths_per_million")
ax.xticks = (1:30:days, string.(covid_death.date)[1:30:days])

f

Thank you.

Solved. Because of this.
image

Seems like the data peaks on a particular weekday. You could smoothen the data so see a trend, e.g. using moving averages. Are you sure that the plot is wrong, or could it be the data itself looking like this?

Thank you. I know where I am wrong.

If I remember right, certainly in the UK, the data for Covid peaked on certain days due to reporting - the reporting was done sometimes on a Monday after a weekend so the data got skewed to Mondays.
I could be wrong

Yes, I checked the data. The number of deaths per million for Germany was also provided once a week. In the dataset, when there was no result, it came to 0.0. That is why the line goes up and down.

@chao you should tune into the thread on Missing values

Why are missing values not ignored by default? - Internals & Design - Julia Programming Language (julialang.org)

1 Like