-
Peter Jentsch authoredPeter Jentsch authored
plotting.jl 1.92 KiB
using Printf
const ts_colors = cgrad(:PuBu_9)
function plot_model(varname,univariate_series, output_list::Vector{T},infection_begin,vac_begin) where T<:DebugRecorder
sim_length = length(output_list[1].recorded_status_totals.S)
ts_list(data) = [
(data.recorded_status_totals.S, "Susceptible over time"),
(data.recorded_status_totals.R, "Recovered over time"),
(data.total_vaccinators, "No. vaccinators over time"),
(data.mean_time_since_last_notification, "Mean time since last notification"),
(data.daily_cases_by_age.Y,"Daily (incident) Y cases"),
(data.daily_cases_by_age.M,"Daily (incident) M cases"),
(data.daily_cases_by_age.O,"Daily (incident) O cases"),
(data.daily_immunized_by_age.Y, "new Y vaccinations each day"),
(data.daily_immunized_by_age.M, "new M vaccinations each day"),
(data.daily_immunized_by_age.O, "new O vaccinations each day"),
]
l = length(ts_list(output_list[1]))
plts = [plot() for i=1:l]
for (i,(p,data)) in enumerate(zip(univariate_series, output_list))
# display(p[varname])
if !isnothing(varname)
p_val = @sprintf "%.4f" (p[varname])
labelname = "$varname = $(p_val)"
else
labelname = nothing
end
for (plt,(ts,title)) in zip(plts,ts_list(data))
plot!(plt, mean.(ts); #yerr = std.(ts),
label = labelname, line_z = i, color=:blues,
ylabel = "no. of people",
colorbar = false,
title = title,
)
end
end
plot!(plts[begin]; legends = :topright)
for p in plts
vline!(p,[infection_begin]; label = "infection begin", line =:dot)
vline!(p,[vac_begin]; label = "vaccination begin",line = :dot)
end
return plot(plts...;layout = (l,1),size=(800,400*l),leftmargin = 12Plots.mm, legend = :outerright)
end