Agents.jl: Interactive plotting - agent traits controllable on a slider

As you can see here the n_sheep property is only used during initialisation of the model. When you use the interactive application provided by InteractiveDynamics.jl, you already provide an existing model to the plotting function, e.g. fig, ax, abmobs = abmplot(sheepwolfgrass; agent_step! = sheepwolf_step!, model_step! = grass_step!, plotkwargs...). This means that whenever you click the reset model button, you just recreate the exact same model that you’ve had when you started the interactive app. :slight_smile: (That’s also the reason why the button is called “reset model” and not “new model” or something similar.)

What you want to do is to create a whole new model on the fly and replace it in the interactive plot. That’s not possible right now. Instead you can just as easily create a new model in the REPL and run the abmplot function again. It’s almost instantaneous so there’s no real downside to it except that you don’t do it via a graphical interface.

Having said that, your expectations regarding the functionality make sense to me. I’ll have a look if I can find the time to implement it.

3 Likes