Skip to content

Giving the user more control in solara visualization of spaces #2389

@quaquel

Description

@quaquel

The current signature for displaying a space is

def make_space_matplotlib(agent_portrayal=None, propertylayer_portrayal=None):

This gives the user explicit control over the agent_portrayal and the propertylayer_portrayal. However, it also means that the mesa code is making implicit assumptions regarding the attribute to which the space is assigned in the model, and how (depending on the used space class) it is to be visualized. Moreover, it makes space visualization not easily extendable by the user. So, I suggest changing the signature to

def make_space_matplotlib(agent_portrayal=None, propertylayer_portrayal=None, space_portrayal=None, space:str =None):

If space_portrayal is None, we can use the existing if elif structure in SpaceMatplotlib to identify the correct space_portrayal function (probably moved into a separate helper function). Likewise, if space is None, we can fall back on checking model.grid and model.space. This same more fine grained API can also be applied to make_space_altair. @Corvince, @EwoutH, any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions