Skip to content

Shift from dict for agent_potrayal to an AgentPortrayalStyle class #2436

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
quaquel opened this issue Oct 30, 2024 · 0 comments · May be fixed by #2728
Open

Shift from dict for agent_potrayal to an AgentPortrayalStyle class #2436

quaquel opened this issue Oct 30, 2024 · 0 comments · May be fixed by #2728
Labels
feature Release notes label visualisation

Comments

@quaquel
Copy link
Member

quaquel commented Oct 30, 2024

Currently, agent_portrayal should return a dict. Valid fields are color, marker, size, and zorder. In #2430 and in a comment on #2389, it has been suggested to shift to an AgentPortrayaStyle class instead. The benefit of this is that is much easier to write your own agent_portrayal function. It also ensures that only valid fields are used. It might make it easier to write agent_portrayal functions that are indifferent about the plotting backend (i.e., altair or matplotlib). Last, it becomes trivial for all draw_x functions in mesa.visualization.compoments.matplotlib to be modifies so agent_portrayal becomes an optional keyword argument.

A while back @wang-boyu also made a remark about this in #1441.

@quaquel quaquel added feature Release notes label visualisation labels Oct 30, 2024
@quaquel quaquel changed the title Shift from dict for agent_potrayal to an AgentPortrayaStyle class Shift from dict for agent_potrayal to an AgentPortrayalStyle class Oct 30, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feature Release notes label visualisation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant