Skip to content
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

update solaraviz function names #237

Merged
merged 2 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions examples/aco_tsp/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import solara
from aco_tsp.model import AcoTspModel, TSPGraph
from matplotlib.figure import Figure
from mesa.visualization import SolaraViz, make_plot_measure
from mesa.visualization import SolaraViz, make_plot_component


def circle_portrayal_example(agent):
Expand Down Expand Up @@ -70,7 +70,10 @@ def ant_level_distances(model):

page = SolaraViz(
model,
components=[make_plot_measure(["best_distance_iter", "best_distance"]), make_graph],
components=[
make_plot_component(["best_distance_iter", "best_distance"]),
make_graph,
],
model_params=model_params,
play_interval=1,
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from mesa.visualization import SolaraViz, make_plot_measure, make_space_matplotlib
from mesa.visualization import SolaraViz, make_plot_component, make_space_component
from model import GameOfLifeModel

propertylayer_portrayal = {
Expand Down Expand Up @@ -38,8 +38,8 @@

gol = GameOfLifeModel()

layer_viz = make_space_matplotlib(propertylayer_portrayal=propertylayer_portrayal)
TotalAlivePlot = make_plot_measure("Cells alive")
layer_viz = make_space_component(propertylayer_portrayal=propertylayer_portrayal)
TotalAlivePlot = make_plot_component("Cells alive")

page = SolaraViz(
gol,
Expand Down
4 changes: 2 additions & 2 deletions examples/hotelling_law/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from hotelling_law.agents import ConsumerAgent, StoreAgent
from hotelling_law.model import HotellingModel
from matplotlib.figure import Figure
from mesa.visualization import SolaraViz, make_plot_measure
from mesa.visualization import SolaraViz, make_plot_component

model_params = {
"N_stores": {
Expand Down Expand Up @@ -349,7 +349,7 @@ def make_revenue_line_chart(model):
make_price_changes_line_chart,
make_market_share_and_price_chart,
make_market_share_line_chart,
make_plot_measure("Price Variance"),
make_plot_component("Price Variance"),
make_revenue_line_chart,
],
name="Hotelling's Law Model",
Expand Down
6 changes: 3 additions & 3 deletions gis/agents_and_networks/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys

from mesa.visualization import Slider, SolaraViz, make_plot_measure
from mesa.visualization import Slider, SolaraViz, make_plot_component
from mesa_geo.visualization import make_geospace_leaflet
from src.model.model import AgentsAndNetworks
from src.visualization.utils import agent_draw, make_plot_clock
Expand Down Expand Up @@ -56,8 +56,8 @@ def parse_args():
[
make_geospace_leaflet(agent_draw, zoom=campus_params[campus]["zoom"]),
make_plot_clock,
make_plot_measure(["status_home", "status_work", "status_traveling"]),
make_plot_measure(["friendship_home", "friendship_work"]),
make_plot_component(["status_home", "status_work", "status_traveling"]),
make_plot_component(["friendship_home", "friendship_work"]),
],
name="Agents and Networks",
model_params=model_params,
Expand Down
4 changes: 2 additions & 2 deletions gis/geo_schelling/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import solara
from mesa.visualization import Slider, SolaraViz, make_plot_measure
from mesa.visualization import Slider, SolaraViz, make_plot_component
from mesa_geo.visualization import make_geospace_leaflet
from model import GeoSchelling

Expand Down Expand Up @@ -34,7 +34,7 @@ def schelling_draw(agent):
model,
[
make_geospace_leaflet(schelling_draw, zoom=4),
make_plot_measure(["happy"]),
make_plot_component(["happy"]),
make_plot_happiness,
],
model_params=model_params,
Expand Down
4 changes: 2 additions & 2 deletions gis/geo_schelling_points/app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import solara
from geo_schelling_points.agents import PersonAgent, RegionAgent
from geo_schelling_points.model import GeoSchellingPoints
from mesa.visualization import Slider, SolaraViz, make_plot_measure
from mesa.visualization import Slider, SolaraViz, make_plot_component
from mesa_geo.visualization import make_geospace_leaflet


Expand Down Expand Up @@ -36,7 +36,7 @@ def schelling_draw(agent):
model,
[
make_geospace_leaflet(schelling_draw, zoom=4),
make_plot_measure(["happy", "unhappy"]),
make_plot_component(["happy", "unhappy"]),
make_plot_happiness,
],
model_params=model_params,
Expand Down
4 changes: 2 additions & 2 deletions gis/geo_sir/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from geo_sir.agents import PersonAgent
from geo_sir.model import GeoSir
from mesa.visualization import Slider, SolaraViz, make_plot_measure
from mesa.visualization import Slider, SolaraViz, make_plot_component
from mesa_geo.visualization import make_geospace_leaflet

model_params = {
Expand Down Expand Up @@ -33,7 +33,7 @@ def infected_draw(agent):
model,
[
make_geospace_leaflet(infected_draw, zoom=12),
make_plot_measure(["infected", "susceptible", "recovered", "dead"]),
make_plot_component(["infected", "susceptible", "recovered", "dead"]),
],
name="Basic agent-based SIR model",
model_params=model_params,
Expand Down
4 changes: 2 additions & 2 deletions gis/rainfall/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Tuple

from mesa.visualization import Slider, SolaraViz, make_plot_measure
from mesa.visualization import Slider, SolaraViz, make_plot_component
from mesa_geo.visualization import make_geospace_leaflet
from rainfall.model import Rainfall
from rainfall.space import LakeCell
Expand Down Expand Up @@ -33,7 +33,7 @@ def cell_portrayal(cell: LakeCell) -> Tuple[float, float, float, float]:
model,
[
make_geospace_leaflet(cell_portrayal, zoom=11),
make_plot_measure(
make_plot_component(
["Total Amount of Water", "Total Contained", "Total Outflow"]
),
],
Expand Down
4 changes: 2 additions & 2 deletions gis/urban_growth/app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Tuple

import solara
from mesa.visualization import Slider, SolaraViz, make_plot_measure
from mesa.visualization import Slider, SolaraViz, make_plot_component
from mesa_geo.visualization import make_geospace_leaflet
from urban_growth.model import UrbanGrowth
from urban_growth.space import UrbanCell
Expand Down Expand Up @@ -37,7 +37,7 @@ def make_plot_urbanized(model):
model,
[
make_geospace_leaflet(cell_portrayal, zoom=12.1),
make_plot_measure(["Percentage Urbanized"]),
make_plot_component(["Percentage Urbanized"]),
make_plot_urbanized,
],
name="Urban Growth Model",
Expand Down
Loading