Skip to content

Shift from dict for agent_potrayal to an AgentPortrayalStyle class #2436

@quaquel

Description

@quaquel

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions