File tree 2 files changed +14
-6
lines changed
2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change 1
- from .jupyter_viz import JupyterViz , make_text # noqa
1
+ from .jupyter_viz import JupyterViz , make_text , prepare_matplotlib_space # noqa
Original file line number Diff line number Diff line change @@ -105,15 +105,23 @@ def _draw_network_grid(viz, space_ax):
105
105
)
106
106
107
107
108
- def make_space (viz ):
109
- space_fig = Figure ()
110
- space_ax = space_fig .subplots ()
108
+ def prepare_matplotlib_space (drawer ):
109
+ def wrapped_drawer (viz ):
110
+ space_fig = Figure ()
111
+ space_ax = space_fig .subplots ()
112
+ drawer (viz , space_fig , space_ax )
113
+ space_ax .set_axis_off ()
114
+ solara .FigureMatplotlib (space_fig , dependencies = [viz .model , viz .df ])
115
+
116
+ return wrapped_drawer
117
+
118
+
119
+ @prepare_matplotlib_space
120
+ def make_space (viz , space_fig , space_ax ):
111
121
if isinstance (viz .model .grid , mesa .space .NetworkGrid ):
112
122
_draw_network_grid (viz , space_ax )
113
123
else :
114
124
space_ax .scatter (** viz .portray (viz .model .grid ))
115
- space_ax .set_axis_off ()
116
- solara .FigureMatplotlib (space_fig , dependencies = [viz .model , viz .df ])
117
125
118
126
119
127
def make_plot (viz , measure ):
You can’t perform that action at this time.
0 commit comments