File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Expand file tree Collapse file tree 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):
105105 )
106106
107107
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 ):
111121 if isinstance (viz .model .grid , mesa .space .NetworkGrid ):
112122 _draw_network_grid (viz , space_ax )
113123 else :
114124 space_ax .scatter (** viz .portray (viz .model .grid ))
115- space_ax .set_axis_off ()
116- solara .FigureMatplotlib (space_fig , dependencies = [viz .model , viz .df ])
117125
118126
119127def make_plot (viz , measure ):
You can’t perform that action at this time.
0 commit comments