@@ -22,7 +22,6 @@ def SpaceMatplotlib(model, agent_portrayal, dependencies: Optional[list[any]] =
22
22
_draw_continuous_space (space , space_ax , agent_portrayal )
23
23
else :
24
24
_draw_grid (space , space_ax , agent_portrayal )
25
- space_ax .set_axis_off ()
26
25
solara .FigureMatplotlib (space_fig , format = "png" , dependencies = dependencies )
27
26
28
27
@@ -93,14 +92,23 @@ def portray(space):
93
92
out ["c" ] = c
94
93
return out
95
94
95
+ # Determine border style based on space.torus
96
+ border_style = 'solid' if not space .torus else (0 , (5 , 10 ))
97
+
98
+ # Set the border of the plot
99
+ for spine in space_ax .spines .values ():
100
+ spine .set_linewidth (1.5 )
101
+ spine .set_color ('black' )
102
+ spine .set_linestyle (border_style )
103
+
96
104
width = space .x_max - space .x_min
97
105
x_padding = width / 20
98
106
height = space .y_max - space .y_min
99
107
y_padding = height / 20
100
108
space_ax .set_xlim (space .x_min - x_padding , space .x_max + x_padding )
101
109
space_ax .set_ylim (space .y_min - y_padding , space .y_max + y_padding )
102
- space_ax .scatter (** portray (space ))
103
110
111
+ # Portray and scatter the agents in the space
104
112
space_ax .scatter (** portray (space ))
105
113
106
114
0 commit comments