Agents.jl: Introductory Tutorial - Error

Hello everybody,

I’m trying to work through the Youtube Tutorial for Agents.jl (Agents.jl: Introductory Tutorial - YouTube) 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/ got unsupported keyword arguments “ac”, “am”
[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.


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?


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?

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)

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