Skip to content

Commit 217cb58

Browse files
authored
rename make_plot_measure to make_plot_component and add some kwargs (#2446)
1 parent 9de5595 commit 217cb58

File tree

12 files changed

+140
-213
lines changed

12 files changed

+140
-213
lines changed

docs/migration_guide.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,15 +281,17 @@ SolaraViz(model, components=[make_space_component(agent_portrayal)])
281281
# old
282282
from mesa.experimental import SolaraViz
283283

284+
284285
def make_plot(model):
285286
...
286287

288+
287289
SolaraViz(model_cls, model_params, measures=[make_plot, "foo", ["bar", "baz"]])
288290

289291
# new
290-
from mesa.visualization import SolaraViz, make_plot_measure
292+
from mesa.visualization import SolaraViz, make_plot_component
291293

292-
SolaraViz(model, components=[make_plot, make_plot_measure("foo"), make_plot_measure("bar", "baz")])
294+
SolaraViz(model, components=[make_plot, make_plot_component("foo"), make_plot_component("bar", "baz")])
293295
```
294296

295297
#### Plotting text

docs/overview.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ 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_component, make_plot_measure
171+
from mesa.visualization import SolaraViz, make_space_component, make_plot_component
172172

173173

174174
def agent_portrayal(agent):
@@ -177,20 +177,20 @@ def agent_portrayal(agent):
177177

178178
model_params = {
179179
"N": {
180-
"type": "SliderInt",
181-
"value": 50,
182-
"label": "Number of agents:",
183-
"min": 10,
184-
"max": 100,
185-
"step": 1,
186-
}
180+
"type": "SliderInt",
181+
"value": 50,
182+
"label": "Number of agents:",
183+
"min": 10,
184+
"max": 100,
185+
"step": 1,
186+
}
187187
}
188188

189189
page = SolaraViz(
190190
MyModel,
191191
[
192-
make_space_component(agent_portrayal),
193-
make_plot_measure("mean_age")
192+
make_space_component(agent_portrayal),
193+
make_plot_component("mean_age")
194194
],
195195
model_params=model_params
196196
)

0 commit comments

Comments
 (0)