Skip to content

Errors on interactive graph plots when hovering the graph outside nodes #1186

@jmaspons

Description

@jmaspons

Describe the bug
Errors when hovering interactive graph plot:

    nested task error: MethodError: no method matching ids_in_position(::Nothing, ::StandardABM{GraphSpace{SimpleGraph{Int64}}, Union{Capital, Worker}, Dict{Int64, Union{Capital, Worker}}, Tuple{DataType, DataType}, typeof(dummystep), typeof(model_step!), typeof(Agents.Schedulers.fastest), ModelParameters, TaskLocalRNG})
    The function `ids_in_position` exists, but no method is defined for this combination of argument types.
    
    Closest candidates are:
      ids_in_position(::Integer, ::AgentBasedModel{<:GraphSpace})
       @ Agents ~/.julia/packages/Agents/WuWeG/src/spaces/graph.jl:94
      ids_in_position(::AbstractAgent, ::Any)
       @ Agents ~/.julia/packages/Agents/WuWeG/src/spaces/discrete.jl:57
      ids_in_position(::Integer, ::GraphSpace)
       @ Agents ~/.julia/packages/Agents/WuWeG/src/spaces/graph.jl:95
      ...
    
    Stacktrace:
     [1] agent2string(model::StandardABM{GraphSpace{SimpleGraph{Int64}}, Union{Capital, Worker}, Dict{Int64, Union{Capital, Worker}}, Tuple{DataType, DataType}, typeof(dummystep), typeof(model_step!), typeof(Agents.Schedulers.fastest), ModelParameters, TaskLocalRNG}, pos::Nothing)
       @ AgentsGraphVisualizations ~/.julia/packages/Agents/WuWeG/ext/AgentsGraphVisualizations/src/spaces/graph.jl:87
     [2] show_data(inspector::DataInspector, p::Plot{AgentsVisualizations._abmplot, Tuple{ABMObservable{Observable{StandardABM{GraphSpace{SimpleGraph{Int64}}, Union{Capital, Worker}, Dict{Int64, Union{Capital, Worker}}, Tuple{DataType, DataType}, typeof(dummystep), typeof(model_step!), typeof(Agents.Schedulers.fastest), ModelParameters, TaskLocalRNG}}, Vector{Tuple{Any, Function, Vararg{Function}}}, Vector{Symbol}, Observable{DataFrame}, Observable{DataFrame}, Bool, Observable{Int64}, Observable{Tuple{Base.RefValue{Int64}, Vector{Int64}}}}}}, idx::UInt32, source::Scatter{Tuple{Vector{Point{2, Float32}}}})
       @ AgentsGraphVisualizations ~/.julia/packages/Agents/WuWeG/ext/AgentsGraphVisualizations/src/spaces/graph.jl:80
     [3] show_data_recursion(inspector::DataInspector, plot::Plot{AgentsVisualizations._abmplot, Tuple{ABMObservable{Observable{StandardABM{GraphSpace{SimpleGraph{Int64}}, Union{Capital, Worker}, Dict{Int64, Union{Capital, Worker}}, Tuple{DataType, DataType}, typeof(dummystep), typeof(model_step!), typeof(Agents.Schedulers.fastest), ModelParameters, TaskLocalRNG}}, Vector{Tuple{Any, Function, Vararg{Function}}}, Vector{Symbol}, Observable{DataFrame}, Observable{DataFrame}, Bool, Observable{Int64}, Observable{Tuple{Base.RefValue{Int64}, Vector{Int64}}}}}}, idx::UInt32, source::Scatter{Tuple{Vector{Point{2, Float32}}}})
       @ Makie ~/.julia/packages/Makie/FUAHr/src/interaction/inspector.jl:373
     [4] show_data_recursion(inspector::DataInspector, plot::Plot{GraphMakie.graphplot, Tuple{SimpleGraph{Int64}}}, idx::UInt32, source::Scatter{Tuple{Vector{Point{2, Float32}}}})
       @ Makie ~/.julia/packages/Makie/FUAHr/src/interaction/inspector.jl:365
     [5] show_data_recursion(inspector::DataInspector, plot::Scatter{Tuple{Vector{Point{2, Float32}}}}, idx::UInt32)
       @ Makie ~/.julia/packages/Makie/FUAHr/src/interaction/inspector.jl:343
     [6] on_hover(inspector::DataInspector)
       @ Makie ~/.julia/packages/Makie/FUAHr/src/interaction/inspector.jl:326
     [7] (::Makie.var"#1138#1139"{Scene, DataInspector})(ch::Channel{Nothing})
       @ Makie ~/.julia/packages/Makie/FUAHr/src/interaction/inspector.jl:291
     [8] (::Base.var"#562#563"{Makie.var"#1138#1139"{Scene, DataInspector}, Channel{Nothing}})()
       @ Base ./channels.jl:141

Minimal Working Example

using Agents, Graphs, GraphMakie, GLMakie

# Minimal GraphSpace model with no agents
g = complete_graph(4)
space = GraphSpace(g)
@agent struct A(GraphAgent) end
model = StandardABM(A, space; properties = Dict(), model_step! = dummystep)

fig, abmobs = abmexploration(model)
fig

Move the pointer around the graph and check the terminal to see the errors

Agents.jl version

[46ada45e] Agents v6.2.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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