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

SolaraViz: Visualize PropertyLayers #2138

Closed
EwoutH opened this issue May 15, 2024 · 4 comments · Fixed by #2336
Closed

SolaraViz: Visualize PropertyLayers #2138

EwoutH opened this issue May 15, 2024 · 4 comments · Fixed by #2336
Labels
Sprints! A task that might be good to tackle during sprints!
Milestone

Comments

@EwoutH
Copy link
Member

EwoutH commented May 15, 2024

Our new (and current) visualization doesn't support visualising PropertyLayers yet. It would be really great if it could do that.

I think you need to decide if you want to use matplotlib or altair for it, and then add it either here:

def SpaceMatplotlib(model, agent_portrayal, dependencies: list[any] | None = None):
space_fig = Figure()
space_ax = space_fig.subplots()
space = getattr(model, "grid", None)
if space is None:
# Sometimes the space is defined as model.space instead of model.grid
space = model.space
if isinstance(space, mesa.space.NetworkGrid):
_draw_network_grid(space, space_ax, agent_portrayal)
elif isinstance(space, mesa.space.ContinuousSpace):
_draw_continuous_space(space, space_ax, agent_portrayal)

or here
def SpaceAltair(model, agent_portrayal, dependencies: list[any] | None = None):
space = getattr(model, "grid", None)
if space is None:
# Sometimes the space is defined as model.space instead of model.grid
space = model.space

@EwoutH EwoutH added the Sprints! A task that might be good to tackle during sprints! label May 21, 2024
@EwoutH EwoutH changed the title JupyterViz: Visualize PropertyLayers SolaraViz: Visualize PropertyLayers Aug 12, 2024
@EwoutH
Copy link
Member Author

EwoutH commented Sep 1, 2024

If I'm correct three people implemented a custom space_drawer recently:

Would one at you give it a go for the PropertyLayer? It's currently blocking us from updating more examples to use the PropertyLayer (and the PropertyGrid), because we can't visualize them in a convenient way yet.

(@Corvince this wouldn't conflict with your work right?)

@EwoutH EwoutH added this to the v3.0 milestone Sep 3, 2024
@EwoutH
Copy link
Member Author

EwoutH commented Sep 23, 2024

@Corvince maybe we need to have some layer system for the visualization, with the grids and layers being in the background and agents moving on top of those. Each layer/grid can have some transparency and an order in which they are stacked.

@Corvince
Copy link
Contributor

I think thats a bit too far into the realms of a visualization library. This should preferably handled by one of those. But this goes into the direction of some previous discussions on how to restructure our plots so they don't redraw from scratch every time. Need to do some more research into that direction.

I think its also important that we soon provide a PropertyLayer for the experimental cell_space, that would make things a lot more future proof and more motivating to work on

@EwoutH EwoutH mentioned this issue Oct 5, 2024
8 tasks
@EwoutH
Copy link
Member Author

EwoutH commented Oct 5, 2024

Implemented in #2336! Example: projectmesa/mesa-examples#214, and now available in Mesa 3.0.0b0.

@EwoutH EwoutH closed this as completed Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Sprints! A task that might be good to tackle during sprints!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants