Issues with abm visualization

Hi,
I’m trying to visualize my agents moving, however, I keep running into this error:
MethodError: Cannot convert an object of type Tuple{Int64} to an object of type GeometryBasics.OffsetInteger{-1, UInt32}

The image I have loaded into my script is .bmp file of dimensions (2337, 3377). I made sure to update abm_video to abmvideo, but am still facing problems.

These are my inputs:
begin
CairoMakie.activate!()
static_preplot!(ax, model) = scatter!(ax, model.goal; color = (:red, 50), marker = ‘x’)
abm_video(
“maze.gif”,
model,
agent_step!;
resolution=(2337, 3377),
frames=1200,
framerate=30,
ac=:red,
as=11,
heatarray = _ → pathfinder.walkmap,
add_colorbar = false,
)
end

Advice would be much appreciated.
Thanks in advance.

please see Please read: make it easier to help you for us to help you, specifically

  • format code
  • provide actually runnable code (what’s model?)
  • provide a minimal working example
  • provide stacktrace
2 Likes

I’m not exactly sure where the error is coming from, but my guess is the resolution keyword argument is not part of abmvideo. I think you have to specify this in the beginning when making your figure

fig = Figure(resolution = ( ))

From the docs, it seems you can also use the figure keyword argument like this (example here)

abmvideo(file, model, agent_step!; figure = (; resolution = (,))

Another issue is that you should be using GLMakie (which uses the GPU for interactivity) instead of CairoMakie (which is used for static plots).

Note that a video is not “interactive”, it’s just a sequence of static images and cairomakie can do that fine.

2 Likes

I learned a thing.

yeap all videos in the docs of Agents.jl are done with CairoMakie :wink:

1 Like