Skip to content

Fix PropertyLayer visualization tutorial to use new SpaceRenderer setup API#3223

Closed
ShreyasN707 wants to merge 19 commits intomesa:mainfrom
ShreyasN707:property_layer_documentation
Closed

Fix PropertyLayer visualization tutorial to use new SpaceRenderer setup API#3223
ShreyasN707 wants to merge 19 commits intomesa:mainfrom
ShreyasN707:property_layer_documentation

Conversation

@ShreyasN707
Copy link
Copy Markdown
Contributor

This updates the Property Layer Visualization tutorial to use setup_structure, setup_agents, and setup_propertylayer instead of deprecated render(...) arguments, fixing the Binder crash reported in #3216.

issue : #3216

@ShreyasN707
Copy link
Copy Markdown
Contributor Author

@EwoutH I have updated the documentation.

@quaquel quaquel added the docs Release notes label label Feb 1, 2026
"if mesa.__version__.startswith((\"3.0\", \"3.1\", \"3.2\")):\n",
" print(\n",
" f\"⚠️ Mesa {mesa.__version__} detected. Visualization features require Mesa 3.3+\"\n",
" f\"\u26a0\ufe0f Mesa {mesa.__version__} detected. Visualization features require Mesa 3.3+\"\n",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's going on here? and in other places with weird unicode related stuff?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both lines render the same warning symbol (⚠️); one uses the literal character and the other a Unicode escape, which is redundant. I’ll clean this up and standardize the warning text.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me instead of the word "warning", I'd prefer this symbol as it's easy to see.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@EwoutH EwoutH requested a review from Sahil-Chhoker February 6, 2026 15:26
@Sahil-Chhoker
Copy link
Copy Markdown
Collaborator

image

I'd like the above block to be:

renderer = (
    SpaceRenderer(model, backend="matplotlib")
    .setup_structure(
        lw=2, ls="solid", color="black", alpha=0.1
    )
    .setup_agents(agent_portrayal)
    .setup_propertylayer(propertylayer_portrayal)
)

# Comment/uncomment the line below to toggle gridlines
renderer.draw_structure()

# Comment/uncomment the line below to toggle agents
renderer.draw_agents()

# Comment/uncomment the line below to toggle propertylayer
renderer.draw_propertylayer()

And the bottom block to be:

renderer = (
    SpaceRenderer(model, backend="matplotlib")
    .setup_structure(
        lw=2, ls="solid", color="black", alpha=0.1
    )
    .setup_agents(agent_portrayal)
    .setup_propertylayer(propertylayer_portrayal)
)
renderer.render()

And please verify the syntax before putting it up.

@ShreyasN707
Copy link
Copy Markdown
Contributor Author

image I'd like the above block to be:
renderer = (
    SpaceRenderer(model, backend="matplotlib")
    .setup_structure(
        lw=2, ls="solid", color="black", alpha=0.1
    )
    .setup_agents(agent_portrayal)
    .setup_propertylayer(propertylayer_portrayal)
)

# Comment/uncomment the line below to toggle gridlines
renderer.draw_structure()

# Comment/uncomment the line below to toggle agents
renderer.draw_agents()

# Comment/uncomment the line below to toggle propertylayer
renderer.draw_propertylayer()

And the bottom block to be:

renderer = (
    SpaceRenderer(model, backend="matplotlib")
    .setup_structure(
        lw=2, ls="solid", color="black", alpha=0.1
    )
    .setup_agents(agent_portrayal)
    .setup_propertylayer(propertylayer_portrayal)
)
renderer.render()

And please verify the syntax before putting it up.

Sure will do it! sorry for late reply was busy with academics.

@Sahil-Chhoker
Copy link
Copy Markdown
Collaborator

image image

Remove these artifacts, I think %capture% would do the trick.

image Also final page is not available, why's that happening?

@ShreyasN707
Copy link
Copy Markdown
Contributor Author

I believe the Page not available issue is due to leftover notebook output during the docs build. I’ll suppress the render output using %capture and clear the notebook outputs so the final page renders correctly.

@Sahil-Chhoker
Copy link
Copy Markdown
Collaborator

The changes of this PR are good, but there seems to be some problem with solara app rendering on readthedocs, it may be an dependency issue as it's in every tutorial visualization.

Failed to load model class 'HtmlModel' from module 'jupyter-vuetify'
Error: Script error for "jupyter-vue", needed by: jupyter-vuetify
http://requirejs.org/docs/errors.html#scripterror
    at makeError (https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js:1:1067)
    at HTMLScriptElement.onScriptError (https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js:1:13218)

@EwoutH do you have any idea what might be causing this? Because upon searching I could only find this old issue which may not be entirely relevant: voila-dashboards/voila#619

@ShreyasN707
Copy link
Copy Markdown
Contributor Author

The changes of this PR are good, but there seems to be some problem with solara app rendering on readthedocs, it may be an dependency issue as it's in every tutorial visualization.

Failed to load model class 'HtmlModel' from module 'jupyter-vuetify'
Error: Script error for "jupyter-vue", needed by: jupyter-vuetify
http://requirejs.org/docs/errors.html#scripterror
    at makeError (https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js:1:1067)
    at HTMLScriptElement.onScriptError (https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js:1:13218)

@EwoutH do you have any idea what might be causing this? Because upon searching I could only find this old issue which may not be entirely relevant: voila-dashboards/voila#619

Even I faced the same. This seems to be related to the Jupyter widget environment (likely ipywidgets / jupyter-vuetify) i.e:

Failed to load model class 'HtmlModel' from module 'jupyter-vuetify'
Script error for "jupyter-vue"

@quaquel
Copy link
Copy Markdown
Member

quaquel commented Feb 23, 2026

Can you take a look at the conflict and update this PR accordingly.

@ShreyasN707
Copy link
Copy Markdown
Contributor Author

yes will do it

@quaquel
Copy link
Copy Markdown
Member

quaquel commented Mar 9, 2026

Closing this as stale

@quaquel quaquel closed this Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Release notes label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants