How to trace positions of agents

Hi,
I have a multiagent model and want to extract agent data from this model. In one of the tutorial examples we have something like:

adata = [(cd4, count), (cd8, count), (dc, count)]
fig, ax, abmobs = abmplot(ln_model; plotkwargs…, adata, mdata)

But…I don’t want to count, but follow the positions of all individual agents (cd4, cd8, and dc) over time. How can I accomplish this?
Thanks,
Antoine

hi, It is not clear to me whether e.g., cd4 is an individual agent or an agent type for which you want the mean position. the answer depends on that.

It is the same as shown in the predator prey example : Predator-prey dynamics · Agents.jl
with
adata = [(sheep, count), (wolf, count)]

Thus, it are individual agents.

I am sorry but you are confusing me. The predator prey model counts how many agents of TYPE sheep there are, and of type wolf. Then you claim it is individual agents. Can you please tell me what you would like to achieve by answering my original question directly?

To answer in advance what I think you want:

agent_ids = [1, 2, 3] # IDs of agents to track pos of
mdata = [
    model -> model[id].pos for id in agent_ids
]

which wil lcollect the position of agents with specified IDs only.

(note how you should not use adata in this case as you are not aggregating over agents, you just need specific agents instead)