Produce a heatmap for agents on a 2d grid with abmplot

Given a agent based model (using Agents.jl) of agents on a 2d grid with values between 0-10 (continuous) is it possible to produce a heatmap using abmplot? (each agent has a Float param) If so what is a straightforward approach for that? Is there an approach which does not require an observable?

abmplot mostly only deals with the actual plotting, so you as a user still have to take care of the data that should be plotted. If you want to create a simple heatmap, have a look at the Preplot related subsection in the docs, specifically at the heatarray kwarg. If you fancy a more fancy heatmap, you can also use the heatkwargs kwarg to style it. And finally, if you want something a lot more involved, you can also just plot a heatmap plot yourself over/under the abmplot (but that would require basic knowledge of observables and the Makie ecosystem, I suppose).

1 Like

Are there any examples to showcase how this can be done for heatmaps of agent properties using the different approaches which you recommend? eg. " heatkwargs = NamedTuple() : Keywords given to Makie.heatmap function if heatarray is not nothing"

Sure thing: All the heatmap examples listed in the Makie docs can be applied in the same way to the abmplot recipe via the heatkwargs keyword argument.

The xs, ys, and zs are determined by the heatarray input to abmplot. The zs are likely what you want to derive from your agent properties.

1 Like