Skip to content

heatarray doesn't work with abmplot for ContinuousSpace #1203

@mjowen

Description

@mjowen

Describe the bug
Since v7, the heatarray option in abmplot has stopped working for ContinuousSpace.

Minimal Working Example
Please provide a piece of code that leads to the bug you encounter.

using Agents, CairoMakie

@agent struct Cell(ContinuousAgent{2, Float64})
end

function model_step!(model)
    return model
end

function initialize_cell_model()
    # Define a properties which can be plotted as a heatmap
    properties = Dict(
        :array => ones(100, 100)
    )

    # Define the space
    space = ContinuousSpace(SVector(1.0, 1.0))

    # Define the model
    model = StandardABM(Cell, space; model_step!, properties)

    return model
end

model = initialize_cell_model()

abmplot(model; heatarray = :array)

Stacktrace

ERROR: MethodError: no method matching abmplot_heatarray(::StandardABM{…}, ::Symbol)
The function `abmplot_heatarray` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  abmplot_heatarray(::AgentBasedModel{<:Agents.AbstractGridSpace}, ::Any)
   @ AgentsVisualizations ~/.julia/packages/Agents/wCO9a/ext/AgentsVisualizations/src/spaces/grid.jl:16

Stacktrace:
 [1] (::AgentsVisualizations.var"#8#9"{})(arg1#277::StandardABM{…})
   @ AgentsVisualizations ./none:-1
 [2] #map#11
   @ ~/.julia/packages/Observables/YdEbO/src/Observables.jl:570 [inlined]
 [3] map
   @ ~/.julia/packages/Observables/YdEbO/src/Observables.jl:568 [inlined]
 [4] abmplot!(ax::Makie.Axis, abmobs::ABMObservable{…}; agent_color::String, agent_size::Int64, agent_marker::Symbol, offset::Nothing, agentsplotkwargs::@NamedTuple{}, heatarray::Symbol, heatkwargs::@NamedTuple{}, preplot!::AgentsVisualizations.var"#12#13", add_colorbar::Bool, colorbar_label::String, adjust_aspect::Bool, spaceplotkwargs::@NamedTuple{}, params::Dict{…}, add_controls::Bool, dt::Nothing, enable_inspection::Bool)
   @ AgentsVisualizations ~/.julia/packages/Agents/wCO9a/ext/AgentsVisualizations/src/abmplot.jl:85
 [5] abmplot(either::StandardABM{…}; adata::Nothing, mdata::Nothing, when::Bool, axis::@NamedTuple{}, params::Dict{…}, add_controls::Bool, figure::@NamedTuple{}, kwargs::@Kwargs{})
   @ AgentsVisualizations ~/.julia/packages/Agents/wCO9a/ext/AgentsVisualizations/src/abmplot.jl:20
 [6] top-level scope
   @ ~/.julia/dev/Mermaid/examples/repressilator/tmp.jl:27
Some type information was truncated. Use `show(err)` to see complete types.

If the code is runnable, it will help us identify the problem faster.

Agents.jl version

Please provide the version you use (you can do Pkg.status("Agents").
Status /private/var/folders/sq/qg5k_lb90mvgph1ysj0cz4sh0000gp/T/jl_KBKr8E/Project.toml
[46ada45e] Agents v7.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers / easy to resolveplotting

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions