diff --git a/docs/make.jl b/docs/make.jl index 29b6390bd1..fe6de20eed 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -14,6 +14,7 @@ pages = [ "examples/zombies.md", "examples/predator_prey.md", "examples/rabbit_fox_hawk.md", + "examples/event_rock_paper_scissors.md", "examples.md" ], "api.md", diff --git a/examples/event_rock_paper_scissors.jl b/examples/event_rock_paper_scissors.jl index a19f0fbac4..e35c157f12 100644 --- a/examples/event_rock_paper_scissors.jl +++ b/examples/event_rock_paper_scissors.jl @@ -274,11 +274,14 @@ adf[1:10, :] # Let's visualize the population sizes versus time: +using Agents.DataFrames +using CairoMakie + tvec = adf[!, :time] populations = adf[:, Not(:time)] -alabels = ["rocks", "papers", "scissorss"] +alabels = ["rocks", "papers", "scissors"] -fig = Figure() +fig = Figure(); ax = Axis(fig[1,1]; xlabel = "time", ylabel = "population") for (i, l) in enumerate(alabels) lines!(ax, tvec, populations[!, i]; label = l) @@ -286,7 +289,6 @@ end axislegend(ax) fig - # ## Visualization # Visualization for [`EventQueueABM`](@ref) is identical to that for [`StandardABM`](@ref) @@ -294,8 +296,6 @@ fig # Naturally, for `EventQueueABM` the `dt` argument of [`abmvideo`](@ref) # corresponds to continuous time and does not have to be an integer. -using CairoMakie - const colormap = Dict(:Rock => "black", :Scissors => "gray", :Paper => "orange") agent_color(agent) = colormap[kindof(agent)] plotkw = (agent_color, agent_marker = :rect, agent_size = 5)