JuliaDynamics/Agents.jl

Remove the blank axis for the space plot for a model with no space

Opened this issue · 0 comments

Currently this code:

using Agents
using GLMakie
using Statistics: mean

## Nothing space

@agent struct NothingAgent(NoSpaceAgent)
    age::Int
end

function nothing_step!(a, m)
    a.age += 1
    rand(abmrng(m)) < (m.d * a.age) && remove_agent!(a, m)
    if nagents(m) >= 2
        if 14 <= a.age <= 70
            rand(abmrng(m)) < (m.b * a.age) && add_agent!(m, 0)
        end
    end
end

function nothing_model()
    properties = Dict(:b => 0.003, :d => 0.002)
    model = ABM(NothingAgent; agent_step! = nothing_step!, properties)
    for _ in 1:1000
        add_agent!(model, rand(abmrng(model), 0:100))
    end
    return model
end

function nothing_test()
    model = nothing_model()
    params = Dict(:b => 0:0.0001:0.005, :d => 0:0.0005:0.01)
    adata = [(:age, maximum), (:age, mean), (:age, minimum)]
    mdata = [nagents]
    fig, _ = abmexploration(model; adata, mdata, params)
    return fig
end

produces

Screenshot from 2023-11-16 19-02-06

It would be nice to remove that blank axis.