animate

plot.animate

Animation utilities for SimulationResult.

Functions

Name Description
animate_network Animate time-series on a graph layout (nodes colored by state value).
animate_phase Animate phase-space trajectory with a trailing tail.
animate_timeseries Animate evolving time-series traces (no graph layout needed).

animate_network

plot.animate.animate_network(
    result,
    state=None,
    interval=50,
    cmap='viridis',
    node_size=120,
    figsize=None,
    format=None,
)

Animate time-series on a graph layout (nodes colored by state value).

Supports the .sel(variable='V').animate() pattern: if the variable dimension is already selected, animates that variable. With no selection all variables are shown (one row per variable).

Graph data is resolved in order: 1. result.graph / result._extras['graph'] (explicitly attached) 2. Experiment metadata via result._source.source.network

Parameters

result : SimulationResult Simulation result, ideally linked to an experiment with a network. state : int, str or None Deprecated — prefer .sel(variable=...). If given, selects a single variable by index or name. interval : int Milliseconds between frames. cmap : str Matplotlib colormap. node_size : int Scatter point size. figsize : tuple, optional

Returns

matplotlib.animation.FuncAnimation

animate_phase

plot.animate.animate_phase(
    result,
    x_var=None,
    y_var=None,
    region=0,
    mode=0,
    interval=50,
    trail=200,
    figsize=(6, 5),
)

Animate phase-space trajectory with a trailing tail.

Parameters

result : SimulationResult x_var, y_var : str, optional region, mode : int interval : int trail : int Number of trailing points. figsize : tuple

Returns

matplotlib.animation.FuncAnimation

animate_timeseries

plot.animate.animate_timeseries(
    result,
    state=None,
    interval=50,
    cmap='viridis',
    figsize=None,
)

Animate evolving time-series traces (no graph layout needed).

Supports .sel(variable='V').animate(type='timeseries'). With no selection, all variables are shown (one panel per variable).

Parameters

result : SimulationResult state : int, str or None If given, selects a single variable by index or name. interval : int Milliseconds between frames. cmap : str Matplotlib colormap. figsize : tuple, optional

Returns

matplotlib.animation.FuncAnimation