Skip to content

Commit

Permalink
fix: Explicitly specify JupyterViz space view limits
Browse files Browse the repository at this point in the history
  • Loading branch information
rht committed Jan 22, 2024
1 parent 67fa130 commit 665aebc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mesa/experimental/components/matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ def portray(g):
out["c"] = c
return out

space_ax.set_xlim(-1, space.width)
space_ax.set_ylim(-1, space.height)
space_ax.scatter(**portray(space))


Expand Down Expand Up @@ -91,6 +93,14 @@ def portray(space):
out["c"] = c
return out

width = space.x_max - space.x_min
x_padding = width / 20
height = space.y_max - space.y_min
y_padding = height / 20
space_ax.set_xlim(space.x_min - x_padding, space.x_max + x_padding)
space_ax.set_ylim(space.y_min - y_padding, space.y_max + y_padding)
space_ax.scatter(**portray(space))

space_ax.scatter(**portray(space))


Expand Down

0 comments on commit 665aebc

Please sign in to comment.