Agents.jl: Introductory Tutorial - Error

Hello everybody,

I’m trying to work through the Youtube Tutorial for Agents.jl (https://www.youtube.com/watch?v=fgwAfAa4kt0) but I got stuck.
When I tried plotting the model it worked fine but when I tried to change the color and the marker I got following Error:

“ERROR: MethodError: no method matching abm_plot(::AgentBasedModel{GridSpace{2, true}, Schelling, typeof(Agents.Schedulers.randomly), Dict{Symbol, Int64}, Random.TaskLocalRNG}; ac=groupcolor, am=groupmarker)
Closest candidates are:
abm_plot(::Any…) at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/base/deprecated.jl:45 got unsupported keyword arguments “ac”, “am”
Stacktrace:
[1] top-level scope
@ ~/Documents/TU/Abschlussarbeit/Julia/Agents Tutorial/Tutorial.jl:87”

I don’t know why it won’t work, I already looked at my lines 45 and 87 but I’ve got the same code as the tutorial.

Screenshot:

Any suggestions what I did wrong? And why does my code color for some symbols look different than the one in the Video, do I need a package that I missed or is it just a color theme?

Greetings,
Floyd

Screenshot 2:

Here is the complete code of the tutorial: Gist of Agents.jl introductory workshop · GitHub

If I just copy and paste it into my Visual Studio I get the same Error for the abm_plot, keywords ac, am and as are unsupported…
(Line 67)

I wonder whether the tutorial is compatible with the version of Agents.jl that you are using. This is a potential hazard of posting code without including an environment with version control.

If you use the most recent version of Agents.jl, does the following example work for you?

https://juliadynamics.github.io/Agents.jl/stable/examples/schelling/

1 Like

I think the problem is that abm_plot is deprecated in Agents.jl 5.2.0. You can use the following instead:

fig, _ = abmplot(model; ac = groupcolor, am = groupmarker, as = 10)
display(fig)
4 Likes

Thanks! That worked!

Seems like the code was not compatible with the new version of Agents.jl.

I’ve updated the gist to latest version and also added a comment on the youtube video

2 Likes