SwarmViz: Integrating Visual and Quantitative Analysis of Collective Movement

During a lab rotation for my Computational Neuroscience MSc at the BCCN Berlin, I developed SwarmViz, a graphical tool intended to assist in the analysis of collective movement data.
The Challenge in Understanding Collective Movement

Figure 1: A public domain photograph of a flock of auklets exhibit swarm behaviour. Shumagins 1986
Collective movement, seen in bird flocks (Figure 1) or fish schools, produces complex datasets when studied via tracking or simulation. Analyzing such data effectively presents a significant challenge, often requiring a balance between two distinct approaches. Visual inspection allows for intuitive pattern recognition and outlier detection, which is invaluable. However, quantitative metrics are essential for objective assessment, comparison between conditions, and summarizing the underlying system dynamics.
SwarmViz: An Integrated Approach

Figure 2: A modified Thymio robot. The camera module is on the top left, the tracking markers on the top right (from the observer’s point of view.)
SwarmViz was developed to bridge this gap between visual intuition and quantitative rigor. Its creation stemmed from the need to analyze data from experiments with modified Thymio robots (Figure 2) implementing a purely vision-based flocking algorithm (see Bastien & Romanczuk, Sci. Adv. 2020). These specific robotic experiments are detailed in an upcoming npj Robotics publication. While born from this context, the tool's design is applicable to general two-dimensional, multi-agent time-series data. The core concept is to provide an environment where users can simultaneously observe the dynamic spatial behavior of agents visually and monitor the corresponding evolution of relevant quantitative metrics in real-time. This integration aims to facilitate quicker preliminary analysis, support hypothesis generation, and help pinpoint notable events or behavioral shifts that might warrant more focused investigation later.
Core Features Facilitating Integrated Analysis

Figure 3: A screenshot of the graphical user interface and visualization of preliminary data. On the top left there is one timestep of the movement data with all optional overlays enabled. On the right there are three graphs of metrics. And on the bottom are the controls for the playback, display and data handling.
- Interactive Visualization: The central element displays agent positions and orientations over time. Crucially, the interface offers smooth playback and direct timeline scrubbing, allowing users to intuitively explore the dataset's temporal dimension. Standard plot interactions like zooming and panning further aid detailed inspection.
- Contextual Geometric Overlays: To better grasp the collective structure, optional visual overlays can be toggled, including the convex hull enclosing the agents, the calculated center of mass, and the swarm's overall diameter.
- Dynamic Clustering Analysis: A key analytical feature performs hierarchical clustering at each timestep, grouping agents based on both spatial proximity and heading alignment. This helps reveal potentially dynamic subgroups or behavioral states within the collective. The results are visualized directly through agent color-coding, and the clustering sensitivity (dissimilarity threshold) is interactively adjustable by the user.
- Synchronized Quantitative Metrics: Alongside the visualization, dedicated panels display time-series plots for selected global metrics. These plots update dynamically with the timeline, offering immediate quantitative context – relating to group alignment (Polarization), coordinated rotation (Rotational Order), cohesion (Interindividual Distance measures), spatial extent (Diameter), and shape (Area, Roundness) – for the behaviors being observed.
Implementation Notes
SwarmViz is implemented in the Julia programming language, utilizing the Makie.jl library for its graphical interface and interactive plotting capabilities. This choice aimed to produce a responsive tool well-suited for interactive scientific data exploration. The calculation of metrics is structured modularly, allowing users familiar with Julia to potentially extend the tool with custom analyses.
Availability and Further Information
SwarmViz is available as open-source software under the MIT License. For comprehensive documentation – including installation guidance, detailed input/output specifications, metric definitions, and usage instructions – along with the source code, citation details, and links to pre-compiled binaries, check out the project's repository on GitHub: