Skip to content

jupyter_viz: Implement multiline plot#1941

Merged
Corvince merged 1 commit intomesa:mainfrom
rht:multiplot
Jan 9, 2024
Merged

jupyter_viz: Implement multiline plot#1941
Corvince merged 1 commit intomesa:mainfrom
rht:multiplot

Conversation

@rht
Copy link
Copy Markdown
Contributor

@rht rht commented Jan 7, 2024

Fixes #1821.

This provides a declarative interface to plotting multiple lines in 1 chart.

Example usage for virus on network

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,

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 7, 2024

Codecov Report

Attention: 11 lines in your changes are missing coverage. Please review.

Comparison is base (4471047) 79.92% compared to head (becd723) 79.31%.

❗ Current head becd723 differs from pull request most recent head c8c53c6. Consider uploading reports for the commit c8c53c6 to get more accurate results

Files Patch % Lines
mesa/experimental/jupyter_viz.py 0.00% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1941      +/-   ##
==========================================
- Coverage   79.92%   79.31%   -0.62%     
==========================================
  Files          15       15              
  Lines        1270     1276       +6     
  Branches      277      282       +5     
==========================================
- Hits         1015     1012       -3     
- Misses        216      225       +9     
  Partials       39       39              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rht
Copy link
Copy Markdown
Contributor Author

rht commented Jan 7, 2024

2024-01-06T19:46:52,358306142-05:00

@EwoutH
Copy link
Copy Markdown
Member

EwoutH commented Jan 7, 2024

This looks very useful!

@EwoutH
Copy link
Copy Markdown
Member

EwoutH commented Jan 9, 2024

This is still in the experimental space right? If so, go ahead!

Fixes mesa#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,
```
@rht
Copy link
Copy Markdown
Contributor Author

rht commented Jan 9, 2024

Rebased.

@Corvince
Copy link
Copy Markdown
Contributor

Corvince commented Jan 9, 2024

Great thank you!

@Corvince Corvince merged commit ee060de into mesa:main Jan 9, 2024
@EwoutH EwoutH added experimental Release notes label enhancement Release notes label labels Jan 9, 2024
@rht rht deleted the multiplot branch January 9, 2024 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Release notes label experimental Release notes label visualisation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JupyterViz: Easy way to plot multiple measures in 1 figure

3 participants