Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Shift from dict for agent_potrayal to an AgentPortrayalStyle class #2436

Open
quaquel opened this issue Oct 30, 2024 · 0 comments
Open

Shift from dict for agent_potrayal to an AgentPortrayalStyle class #2436

quaquel opened this issue Oct 30, 2024 · 0 comments
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Release notes label visualisation
Projects
None yet
Development

No branches or pull requests

1 participant