From bdbf7ab870e084add8dac97dd078c5a1f7ebd2cd Mon Sep 17 00:00:00 2001 From: Tortar Date: Thu, 14 Mar 2024 01:31:47 +0100 Subject: [PATCH] Use time for previous step column in examples --- examples/agents_visualizations.jl | 4 ++-- examples/measurements.jl | 12 ++++++------ examples/predator_prey.jl | 6 +++--- examples/sir.jl | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/agents_visualizations.jl b/examples/agents_visualizations.jl index 0ff0b14c95..144818bd0d 100644 --- a/examples/agents_visualizations.jl +++ b/examples/agents_visualizations.jl @@ -192,8 +192,8 @@ plot_layout = fig[:,end+1] = GridLayout() count_layout = plot_layout[1,1] = GridLayout() # collect tuples with x and y values for black and white daisys -blacks = @lift(Point2f.($(abmobs.adf).step, $(abmobs.adf).count_black)) -whites = @lift(Point2f.($(abmobs.adf).step, $(abmobs.adf).count_white)) +blacks = @lift(Point2f.($(abmobs.adf).time, $(abmobs.adf).count_black)) +whites = @lift(Point2f.($(abmobs.adf).time, $(abmobs.adf).count_white)) # create an axis to plot into and style it to our liking ax_counts = Axis(count_layout[1,1]; diff --git a/examples/measurements.jl b/examples/measurements.jl index beffa4f31c..ada35c457d 100644 --- a/examples/measurements.jl +++ b/examples/measurements.jl @@ -190,8 +190,8 @@ agent_df, model_df = run!(model, 1000; adata = adata, mdata = mdata) f = Figure(resolution = (600, 800)) ax = f[1, 1] = Axis(f, ylabel = "Daisy count", title = "Daisyworld Analysis") -lb = lines!(ax, agent_df.step, agent_df.count_black_daisies, linewidth = 2, color = :blue) -lw = lines!(ax, agent_df.step, agent_df.count_white_daisies, linewidth = 2, color = :red) +lb = lines!(ax, agent_df.time, agent_df.count_black_daisies, linewidth = 2, color = :blue) +lw = lines!(ax, agent_df.time, agent_df.count_white_daisies, linewidth = 2, color = :red) leg = f[1, 1] = Legend( f, [lb, lw], @@ -210,10 +210,10 @@ highband = lowband = Measurements.value.(agent_df[!, dataname(adata[3])]) - Measurements.uncertainty.(agent_df[!, dataname(adata[3])]) -band!(ax2, agent_df.step, lowband, highband, color = (:steelblue, 0.5)) +band!(ax2, agent_df.time, lowband, highband, color = (:steelblue, 0.5)) lines!( ax2, - agent_df.step, + agent_df.time, Measurements.value.(agent_df[!, dataname(adata[3])]), linewidth = 2, color = :blue, @@ -226,10 +226,10 @@ highband = lowband = Measurements.value.(model_df.solar_luminosity) - Measurements.uncertainty.(model_df.solar_luminosity) -band!(ax3, agent_df.step, lowband, highband, color = (:steelblue, 0.5)) +band!(ax3, agent_df.time, lowband, highband, color = (:steelblue, 0.5)) lines!( ax3, - agent_df.step, + agent_df.time, Measurements.value.(model_df.solar_luminosity), linewidth = 2, color = :blue, diff --git a/examples/predator_prey.jl b/examples/predator_prey.jl index 97dfdfb47b..3fb1b8b2c4 100644 --- a/examples/predator_prey.jl +++ b/examples/predator_prey.jl @@ -242,9 +242,9 @@ adf, mdf = run!(sheepwolfgrass, steps; adata, mdata) function plot_population_timeseries(adf, mdf) figure = Figure(size = (600, 400)) ax = figure[1, 1] = Axis(figure; xlabel = "Step", ylabel = "Population") - sheepl = lines!(ax, adf.step, adf.count_sheep, color = :cornsilk4) - wolfl = lines!(ax, adf.step, adf.count_wolf, color = RGBAf(0.2, 0.2, 0.3)) - grassl = lines!(ax, mdf.step, mdf.count_grass, color = :green) + sheepl = lines!(ax, adf.time, adf.count_sheep, color = :cornsilk4) + wolfl = lines!(ax, adf.time, adf.count_wolf, color = RGBAf(0.2, 0.2, 0.3)) + grassl = lines!(ax, mdf.time, mdf.count_grass, color = :green) figure[1, 2] = Legend(figure, [sheepl, wolfl, grassl], ["Sheep", "Wolves", "Grass"]) figure end diff --git a/examples/sir.jl b/examples/sir.jl index e02dd8346e..7788cdf046 100644 --- a/examples/sir.jl +++ b/examples/sir.jl @@ -288,10 +288,10 @@ data[1:10, :] N = sum(model.Ns) # Total initial population fig = Figure(size = (600, 400)) ax = fig[1, 1] = Axis(fig, xlabel = "steps", ylabel = "log10(count)") -li = lines!(ax, data.step, log10.(data[:, dataname((:status, infected))]), color = :blue) -lr = lines!(ax, data.step, log10.(data[:, dataname((:status, recovered))]), color = :red) +li = lines!(ax, data.time, log10.(data[:, dataname((:status, infected))]), color = :blue) +lr = lines!(ax, data.time, log10.(data[:, dataname((:status, recovered))]), color = :red) dead = log10.(N .- data[:, dataname((:status, length))]) -ld = lines!(ax, data.step, dead, color = :green) +ld = lines!(ax, data.time, dead, color = :green) Legend(fig[1, 2], [li, lr, ld], ["infected", "recovered", "dead"]) fig