Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jupyter_viz: Allow measures to be None #2163

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions mesa/visualization/jupyter_viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,15 @@
# otherwise, do nothing (do not draw space)

# 5. Plots
for measure in measures:
if callable(measure):
# Is a custom object
measure(model)
else:
components_matplotlib.PlotMatplotlib(
model, measure, dependencies=dependencies
)
if measures:
for measure in measures:
if callable(measure):
# Is a custom object
measure(model)

Check warning on line 150 in mesa/visualization/jupyter_viz.py

View check run for this annotation

Codecov / codecov/patch

mesa/visualization/jupyter_viz.py#L150

Added line #L150 was not covered by tests
else:
components_matplotlib.PlotMatplotlib(

Check warning on line 152 in mesa/visualization/jupyter_viz.py

View check run for this annotation

Codecov / codecov/patch

mesa/visualization/jupyter_viz.py#L152

Added line #L152 was not covered by tests
model, measure, dependencies=dependencies
)

def render_in_browser():
# if space drawer is disabled, do not include it
Expand Down