-
Notifications
You must be signed in to change notification settings - Fork 917
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
JupyterViz: Easy way to plot multiple measures in 1 figure #1821
Comments
If there is no objection to my proposed design, this would be quick for @ankitk50 to implement. |
Can you also give an example model where this can be tested? |
This example already implements the feature: https://github.com/projectmesa/mesa-examples/tree/main/examples/virus_on_network. It just needs to be ported to core Mesa. |
@ankitk50 this is very likely to be a quick merge, since the other 2 PRs are still in draft. |
What's the current status of this effort? |
Fixes projectmesa#1821. This provides a declarative interface to plotting multiple lines in 1 chart. Example usage for virus on network ```python page = JupyterViz( VirusOnNetwork, model_params, measures=[ # This is subject to change, as it could have been # {"Infected": {"color": "tab:red"}}, but let's keep it simple. {"Infected": "tab:red", "Susceptible": "tab:green", "Resistant": "tab:gray"}, # Alternatively, if you don't want to manually specify colors: # ["Infected", "Susceptible", "Resistant"], make_text(get_resistant_susceptible_ratio), ], name="Virus Model", agent_portrayal=agent_portrayal, ```
Fixes projectmesa#1821. This provides a declarative interface to plotting multiple lines in 1 chart. Example usage for virus on network ```python page = JupyterViz( VirusOnNetwork, model_params, measures=[ # This is subject to change, as it could have been # {"Infected": {"color": "tab:red"}}, but let's keep it simple. {"Infected": "tab:red", "Susceptible": "tab:green", "Resistant": "tab:gray"}, # Alternatively, if you don't want to manually specify colors: # ["Infected", "Susceptible", "Resistant"], make_text(get_resistant_susceptible_ratio), ], name="Virus Model", agent_portrayal=agent_portrayal, ```
Fixes projectmesa#1821. This provides a declarative interface to plotting multiple lines in 1 chart. Example usage for virus on network ```python page = JupyterViz( VirusOnNetwork, model_params, measures=[ # This is subject to change, as it could have been # {"Infected": {"color": "tab:red"}}, but let's keep it simple. {"Infected": "tab:red", "Susceptible": "tab:green", "Resistant": "tab:gray"}, # Alternatively, if you don't want to manually specify colors: # ["Infected", "Susceptible", "Resistant"], make_text(get_resistant_susceptible_ratio), ], name="Virus Model", agent_portrayal=agent_portrayal, ```
Fixes projectmesa#1821. This provides a declarative interface to plotting multiple lines in 1 chart. Example usage for virus on network ```python page = JupyterViz( VirusOnNetwork, model_params, measures=[ # This is subject to change, as it could have been # {"Infected": {"color": "tab:red"}}, but let's keep it simple. {"Infected": "tab:red", "Susceptible": "tab:green", "Resistant": "tab:gray"}, # Alternatively, if you don't want to manually specify colors: # ["Infected", "Susceptible", "Resistant"], make_text(get_resistant_susceptible_ratio), ], name="Virus Model", agent_portrayal=agent_portrayal, ```
Fixes #1821. This provides a declarative interface to plotting multiple lines in 1 chart. Example usage for virus on network ```python page = JupyterViz( VirusOnNetwork, model_params, measures=[ # This is subject to change, as it could have been # {"Infected": {"color": "tab:red"}}, but let's keep it simple. {"Infected": "tab:red", "Susceptible": "tab:green", "Resistant": "tab:gray"}, # Alternatively, if you don't want to manually specify colors: # ["Infected", "Susceptible", "Resistant"], make_text(get_resistant_susceptible_ratio), ], name="Virus Model", agent_portrayal=agent_portrayal, ```
What's the problem this feature will solve?
Currently, each agent variable can only be plotted in separate figures. The virus on a network example is one such use case where we want to plot everything in one figure. See projectmesa/mesa-examples#56 (comment).
Describe the solution you'd like
Supporting this could be as simple as detecting if
measure
inmesa/mesa/experimental/jupyter_viz.py
Line 287 in 734496c
The text was updated successfully, but these errors were encountered: