You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add animation functions for trajectories and Voronoi cells in Jupyter notebooks #550
Add animate_trajectories and animate_voronoi_cells functions to PedPy that render frame-by-frame animations of pedestrian data directly in Jupyter notebooks.
Background / Context
PedPy currently supports static trajectory and Voronoi plots but has no animation capability. Animating pedestrian movement over time is a core analysis and presentation need for users working in notebook-based workflows. This is a frequently requested feature.
Technical Details
Animations should be based on matplotlib.animation.FuncAnimation and rendered in notebooks via IPython.display.HTML
Interface should align with existing plot_trajectories for parameter naming consistency (e.g. traj, walkable_area, color_data, color_column, cmap)
IPython should be an optional dependency with a descriptive error when called outside a notebook environment
New functions belong in pedpy/plotting/
Acceptance Criteria
Usage is demonstrated in the user guide notebook
IPython is listed as an optional dependency with a descriptive error when missing
I would really appreciate that feature!
Besides being able to animate the trajectories (e.g as points with adjustable size), a third column of the data, e.g. speed but also some other result of the analysis, should be usable as color for the animated trajectory points.
That would be a great feature to have a (quick) overview of the analysis without beeing forced to save all frames as files and create a video out of that.
Opened #596 implementing animate_trajectories and animate_voronoi_cells in pedpy.plotting.animation (and exported directly from pedpy).
In particular, addressing @mirakuepper's point above:
Adjustable point size:animate_trajectories supports marker_size (and traj_frame_marker_size for consistency with plot_trajectories).
Coloring by any scalar column or analysis DataFrame: You can either pass a separate per-frame DataFrame via color_data=individual_speed, color_column=SPEED_COL (or omit color_column when color_data has a single value column) or reference an extra column already present in traj.data via color_column=..., with configurable cmap, vmin, vmax, and colorbar label.
Notebook & script support: In Jupyter notebooks (pip install pedpy[notebook]), as_html=True (default) renders an interactive JSHTML player inline; outside notebooks, as_html=False returns the matplotlib.animation.FuncAnimation object directly.
Activity
mirakuepper commentedon Nov 5, 2026
I would really appreciate that feature!
Besides being able to animate the trajectories (e.g as points with adjustable size), a third column of the data, e.g. speed but also some other result of the analysis, should be usable as color for the animated trajectory points.
That would be a great feature to have a (quick) overview of the analysis without beeing forced to save all frames as files and create a video out of that.
M-Colley commentedon Nov 21, 2026
Opened #596 implementing
animate_trajectoriesandanimate_voronoi_cellsinpedpy.plotting.animation(and exported directly frompedpy).In particular, addressing @mirakuepper's point above:
animate_trajectoriessupportsmarker_size(andtraj_frame_marker_sizefor consistency withplot_trajectories).color_data=individual_speed, color_column=SPEED_COL(or omitcolor_columnwhencolor_datahas a single value column) or reference an extra column already present intraj.dataviacolor_column=..., with configurablecmap,vmin,vmax, and colorbar label.pip install pedpy[notebook]),as_html=True(default) renders an interactive JSHTML player inline; outside notebooks,as_html=Falsereturns thematplotlib.animation.FuncAnimationobject directly.