Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use time for previous step column in examples #1005

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/agents_visualizations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
12 changes: 6 additions & 6 deletions examples/measurements.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand All @@ -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,
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions examples/predator_prey.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions examples/sir.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading