Skip to content
Snippets Groups Projects
Commit 1d9779a4 authored by xo30xoqa's avatar xo30xoqa
Browse files

Prettified population trend plot

parent 22268d34
Branches
Tags
No related merge requests found
......@@ -39,12 +39,15 @@ Returns a Makie figure object.
"""
function populationtrends(model::AgentBasedModel)
pops = model.datatables["populations"]
dates = @param(core.startdate):@param(core.enddate)
f = Figure()
ax = Axis(f[1,1])
ax = Axis(f[1,1], xlabel="Date", ylabel="Population size",
xtickformat = timeseries -> [Dates.format(dates[Int(d+1)], "dd/mm/yyyy")
for d in timeseries])
for s in unique(pops.Species)
points = @select!(@subset(pops, :Species .== s), :Abundance)
lines!(f[1,1], Vector{Float32}(points.Abundance))
lines!(f[1,1], Vector{Float32}(points.Abundance), linewidth=3, label=s)
end
#TODO prettify, add legend & labels
axislegend("Species"; position=:lt)
f
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment