mesa icon indicating copy to clipboard operation
mesa copied to clipboard

frontend: Initialize Jupyter space widget via Bokeh

Open rht opened this issue 3 years ago • 1 comments

To test this:

  • pip install bokeh panel
  • Initialize a fresh empty .ipynb
  • Copy the entirety of https://github.com/projectmesa/mesa/blob/main/examples/schelling/model.py into the first cell
  • Put this into the 2nd cell
# #d62728 is tab:red, #1f77b4 is tab:blue
portray = lambda agent: "#d62728" if agent.type == 0 else "#1f77b4"
jv = mesa.visualization.JupyterSpaceVisualization(Schelling, portray)
jv.pane
  • Put this into the 3rd cell: jv.run()
  • In the navigation bar of the Jupyter web UI, click Cell > Run All

rht avatar Jun 26 '22 09:06 rht

This is based on @dmnfarrell 's awesome blog post.

rht avatar Jun 26 '22 09:06 rht

Closed in favor of discussion in https://github.com/projectmesa/mesa/discussions/1622.

rht avatar May 10 '23 12:05 rht