File tree 2 files changed +13
-6
lines changed
2 files changed +13
-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,22 @@ 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
+ return wrapped_drawer
116
+
117
+
118
+ @prepare_matplotlib_space
119
+ def make_space (viz , space_fig , space_ax ):
111
120
if isinstance (viz .model .grid , mesa .space .NetworkGrid ):
112
121
_draw_network_grid (viz , space_ax )
113
122
else :
114
123
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
124
118
125
119
126
def make_plot (viz , measure ):
You can’t perform that action at this time.
0 commit comments