Running Examples
# Build examples
cmake -B build -DSPECTRA_BUILD_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)
# Run
./build/examples/basic_line
./build/examples/demo_3d
./build/examples/easy_api_demo
# Windows
.\build\examples\Release\basic_line.exe
Core Plotting (C++)
| Example | Description |
|---|---|
basic_line.cpp | Minimal line plot |
easy_api_demo.cpp | Easy API progressive complexity showcase |
easy_realtime_demo.cpp | Multi-signal sensor dashboard with tabs |
live_stream.cpp | Real-time streaming data |
animated_scatter.cpp | Animated scatter plot |
multi_subplot.cpp | Grid-based subplot layout |
multi_figure_demo.cpp | Multiple figures with tabs |
multi_window_tabs_demo.cpp | Tab tear-off and multi-window |
plot_styles_demo.cpp | All 18 markers, dash patterns, format strings |
stats_demo.cpp | Box plot, violin, histogram, bar chart |
empty_launch_csv.cpp | Empty canvas + CSV data loading |
comprehensive_subplot_demo.cpp | Full subplot grid feature tour |
multi_window_demo.cpp | Independent OS windows, peer-equivalent |
eigen_demo.cpp | Plot directly from Eigen matrices / vectors |
logger_example.cpp | Spectra structured logging |
shapes_demo.cpp | 2D shape primitives overlay |
3D Visualization
| Example | Description |
|---|---|
demo_3d.cpp | 3D scatter, line, surface, mesh showcase |
surface_3d.cpp | 3D surface with colormap |
lit_surface_demo.cpp | Blinn-Phong lit surface with materials |
transparency_demo.cpp | Transparent surfaces, wireframe, painter's sort |
mind_blowing_3d.cpp | Advanced 3D visualization |
mode_transition_demo.cpp | Animated 2D↔3D view switching |
axes3d_demo.cpp | 3D axes / grid / tick label rendering |
simple_3d_scatter.cpp | Minimal 3D scatter plot |
parametric_3d_line.cpp | Parametric 3D curves |
shapes3d_demo.cpp | 3D primitives (cubes, spheres, arrows) |
realtime_3d_stream.cpp | Live-streaming 3D data |
camera_animation_3d.cpp | Scripted 3D camera fly-through |
Animation & Recording
| Example | Description |
|---|---|
advanced_animation_demo.cpp | Frame updates, pacing, timeline workflows |
timeline_animation_demo.cpp | Timeline editor with keyframes |
timeline_curve_demo.cpp | Animation curve editor |
camera_animator_demo.cpp | Camera orbit and turntable animation |
offscreen_export.cpp | Headless PNG export |
video_record.cpp | MP4 recording via ffmpeg |
UI & Extensibility
| Example | Description |
|---|---|
shortcut_config_demo.cpp | Custom keybinding persistence |
plugin_api_demo.cpp | Plugin system demonstration |
qt_embed_demo.cpp | Native Qt + Vulkan integration — see Qt Embedding |
embed_cpp_demo.cpp | C++ embed surface (host any OS window) |
easy_embed_demo.cpp | Headless one-liner rendering — see guide |
knob_demo.cpp | Interactive knob overlay widgets |
shortcut_usage_demo.cpp | Default shortcut tour |
axes_menu_demo.cpp | Axes context menu customisation |
legend_panel_test.cpp | Legend panel layout |
Topics & Multi-Process
| Example | Description |
|---|---|
topic_publisher.cpp | Publish a named topic to spectra-backend — see Topics guide |
multiproc_demo.sh | End-to-end daemon + window agent walkthrough |
WebGPU / WASM
| Example | Description |
|---|---|
webgpu_demo.cpp | 2D plotting via WebGPU — see WebGPU guide |
webgpu_shell.html | HTML shell for the Emscripten build |
ROS2 Demos
| Example | Description |
|---|---|
ros2_demo.cpp | Minimal ROS2 subscriber + plot — see ROS2 Adapter |
ros2_ui_preview.cpp | ROS2 panel UI preview without a live graph |
PX4 / ULog
The PX4 adapter ships as a standalone spectra-px4 binary rather than an example program. See the PX4 Adapter guide for ULog and MAVLink workflows.
./build/spectra-px4 flight.ulg
./build/spectra-px4 --connect --port 14540
Python Examples
Located in python/examples/:
| Example | Description |
|---|---|
basic_line.py | Simple line plot |
easy_3d.py | 3D plotting from Python |
easy_live_dashboard.py | Live streaming dashboard |
easy_multi_live.py | Multi-signal live streams |
easy_subplots.py | Subplot layouts |
# Run Python examples
cd python && pip install -e ".[dev]"
python examples/basic_line.py
python examples/easy_live_dashboard.py
ROS2 Launch Files
Located in examples/ros2_launch/:
| File | Description |
|---|---|
imu_monitor.launch.py | Linear acceleration + angular velocity from sensor_msgs/Imu |
nav_dashboard.launch.py | cmd_vel + odom fields for navigation monitoring |
bag_replay.launch.py | Open a rosbag by path with configurable rate and loop |
ros2 launch spectra imu_monitor.launch.py
ros2 launch spectra nav_dashboard.launch.py cmd_vel:=/cmd_vel_mux/input/navi
ros2 launch spectra bag_replay.launch.py bag:=/data/run42.mcap rate:=2.0
Use this page as your team onboarding index. For full API details, see the Feature Guide. For build instructions, see Getting Started.