Skip to content

Visualisation: Allow different shapes agent portrayals #2164

@EwoutH

Description

@EwoutH

In the old visualisation you could add values like "Shape": "circle" and "Filled": "true" to the agent_portrayal dict.

With the new Solara based visualisation, that's not yet possible. It should be implemented in mesa/visualization/components. Somewhere around here:

has_color = "color" in all_agent_data[0]
if has_color:
encoding_dict["color"] = alt.Color("color", type="nominal")
has_size = "size" in all_agent_data[0]
if has_size:
encoding_dict["size"] = alt.Size("size", type="quantitative")

and maybe also in:
for agent in content:
data = agent_portrayal(agent)
x.append(i)
y.append(j)
if "size" in data:
s.append(data["size"])
if "color" in data:
c.append(data["color"])

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions