Skip to content

draw_space only works if there is at least one agent #2638

@quaquel

Description

@quaquel

Describe the bug
If you try to draw a space and there are no agents in the space, you get an index error

Expected behavior
the space should simply be drawn without any agents

To Reproduce

from mesa.experimental.cell_space import OrthogonalMooreGrid, CellAgent
from mesa import Model
from mesa.visualization import draw_space

model = Model(seed=42)
space = OrthogonalMooreGrid((10,5), random=model.random)

fig, ax = plt.subplots()

draw_space(space, ax=ax)
plt.show()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Sprints!A task that might be good to tackle during sprints!visualisation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions