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

Adds Altair plot component and some other fixes #2644

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
566b72f
renamed make_space_altair
nissu99 Jan 26, 2025
e1f947c
added make_altair_plot_component support
nissu99 Jan 26, 2025
9e3a625
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 26, 2025
a88d816
Update altair_components.py
nissu99 Jan 27, 2025
c579f81
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 27, 2025
489c0fd
Merge branch 'main' into main
nissu99 Jan 27, 2025
95a607b
Update altair_components.py
nissu99 Jan 27, 2025
8e1779b
Update pyproject.toml
nissu99 Jan 27, 2025
2b69a62
Update altair_components.py
nissu99 Jan 27, 2025
b5613f1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 27, 2025
0d1b8be
Update altair_components.py
nissu99 Jan 27, 2025
ed8ca71
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 27, 2025
da8fd53
Update altair_components.py
nissu99 Jan 27, 2025
24210f4
Merge branch 'main' into main
nissu99 Jan 31, 2025
4a38eef
blank
nissu99 Jan 31, 2025
c49f864
resolved conflicts
nissu99 Jan 31, 2025
97de970
Merge branch 'main' into main
nissu99 Jan 31, 2025
0621810
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 31, 2025
7bdbc18
Merge branch 'main' into main
quaquel Feb 2, 2025
a380bc6
Merge branch 'main' into main
quaquel Feb 5, 2025
227262c
changed to switch statements
nissu99 Feb 11, 2025
c61808f
switch cases added
nissu99 Feb 11, 2025
e6be172
Merge branch 'main' into main
nissu99 Feb 11, 2025
b024b32
resolves
nissu99 Feb 11, 2025
cd7cbc6
Merge branch 'main' into main
quaquel Feb 16, 2025
0a37307
changes regarding updating agent position and docs
nissu99 Feb 16, 2025
4d1bd06
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 16, 2025
d6e96b0
resize fix
nissu99 Feb 17, 2025
54daa24
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 17, 2025
3d53d52
removed unused parameter
nissu99 Feb 18, 2025
329bd24
removed generic_data_collection function
nissu99 Feb 18, 2025
a29c557
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 18, 2025
0631373
fixed altiar plotting
nissu99 Mar 1, 2025
22044f6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 1, 2025
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
3 changes: 2 additions & 1 deletion mesa/visualization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
)

from .components import make_plot_component, make_space_component
from .components.altair_components import make_space_altair
from .components.altair_components import make_altair_plot_component, make_space_altair
from .solara_viz import JupyterViz, SolaraViz
from .user_param import Slider

Expand All @@ -19,6 +19,7 @@
"Slider",
"SolaraViz",
"draw_space",
"make_altair_plot_component",
"make_plot_component",
"make_space_altair",
"make_space_component",
Expand Down
11 changes: 6 additions & 5 deletions mesa/visualization/components/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@

from collections.abc import Callable

from .altair_components import SpaceAltair, make_altair_space
from .altair_components import (
SpaceAltair,
make_altair_plot_component,
make_altair_space,
)
from .matplotlib_components import (
SpaceMatplotlib,
make_mpl_plot_component,
Expand Down Expand Up @@ -67,16 +71,13 @@ def make_plot_component(
backend: the backend to use {"matplotlib", "altair"}
plot_drawing_kwargs: additional keyword arguments to pass onto the backend specific function for making a plotting component

Notes:
altair plotting backend is not yet implemented and planned for mesa 3.1.

Returns:
function: A function that creates a plot component
"""
if backend == "matplotlib":
return make_mpl_plot_component(measure, post_process, **plot_drawing_kwargs)
elif backend == "altair":
raise NotImplementedError("altair line plots are not yet implemented")
return make_altair_plot_component(measure, post_process, **plot_drawing_kwargs)
else:
raise ValueError(
f"unknown backend {backend}, must be one of matplotlib, altair"
Expand Down
Loading
Loading