Skip to content

Commit 92054d7

Browse files
authored
Matplotlib refactor (#2430)
1 parent aaf9026 commit 92054d7

File tree

17 files changed

+911
-300
lines changed

17 files changed

+911
-300
lines changed

docs/apis/visualization.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,22 @@ For a detailed tutorial, please refer to our [Visualization Tutorial](../tutoria
1919
:undoc-members:
2020
:show-inheritance:
2121
```
22+
23+
24+
## Matplotlib-based components
25+
26+
```{eval-rst}
27+
.. automodule:: mesa.visualization.components.matplotlib
28+
:members:
29+
:undoc-members:
30+
:show-inheritance:
31+
```
32+
33+
## Altair-based components
34+
35+
```{eval-rst}
36+
.. automodule:: mesa.visualization.components.altair
37+
:members:
38+
:undoc-members:
39+
:show-inheritance:
40+
```

docs/migration_guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,9 @@ from mesa.experimental import SolaraViz
268268
SolaraViz(model_cls, model_params, agent_portrayal=agent_portrayal)
269269

270270
# new
271-
from mesa.visualization import SolaraViz, make_space_matplotlib
271+
from mesa.visualization import SolaraViz, make_space_component
272272

273-
SolaraViz(model, components=[make_space_matplotlib(agent_portrayal)])
273+
SolaraViz(model, components=[make_space_component(agent_portrayal)])
274274
```
275275

276276
#### Plotting "measures"

docs/overview.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,13 @@ The results are returned as a list of dictionaries, which can be easily converte
168168
Mesa now uses a new browser-based visualization system called SolaraViz. This allows for interactive, customizable visualizations of your models. Here's a basic example of how to set up a visualization:
169169

170170
```python
171-
from mesa.visualization import SolaraViz, make_space_matplotlib, make_plot_measure
171+
from mesa.visualization import SolaraViz, make_space_component, make_plot_measure
172+
172173

173174
def agent_portrayal(agent):
174175
return {"color": "blue", "size": 50}
175176

177+
176178
model_params = {
177179
"N": {
178180
"type": "SliderInt",
@@ -187,7 +189,7 @@ model_params = {
187189
page = SolaraViz(
188190
MyModel,
189191
[
190-
make_space_matplotlib(agent_portrayal),
192+
make_space_component(agent_portrayal),
191193
make_plot_measure("mean_age")
192194
],
193195
model_params=model_params

0 commit comments

Comments
 (0)