Spectra 0.4.2 · open source, MIT

GPU-accelerated plotting for C++, Python and Rust

Spectra draws 2D and 3D plots on the GPU with Vulkan. Plot ten million points and still redraw in about a millisecond, stream live data at display rate, and explore it in a desktop app with linked axes, an inspector and drag-and-drop data files.

Vulkan 1.2+ 2D + 3D C++20 · Python · Rust Interactive + headless
Coreplotting, UI, export
1.2 msredraw at 10M points
APIsC++, Python, Rust
FilesCSV, ULog, MCAP
One Spectra window with six live plots: a sensor stream, a Lorenz attractor, a lit 3D surface, a reaction-diffusion heatmap, a particle flow and a histogram

Feature Map

Spectra spans rendering, interaction, animation, desktop workflows, and Python and Rust clients.

Rendering Engine

  • Vulkan 1.2+ GPU backend
  • 2D + 3D plotting pipelines
  • Depth buffer + MSAA + high-quality text

Interactive Workflows

  • Multi-window tabs + docking + split view
  • Crosshair, markers, linked axes, shared cursor
  • Undo/redo, command palette, configurable shortcuts

Animation + Automation

  • Frame callbacks and real-time streaming
  • Timeline editor + keyframe interpolation
  • PNG, SVG, PDF, GIF and MP4 export

Your Data In

  • CSV, PX4 ULog and MCAP logs by drag and drop
  • Named live topics from any process, UDP bridge
  • Layout files that reopen a dashboard on new data

Python

  • One-liners and a matplotlib-style spectra.pyplot
  • pandas DataFrames, NumPy fast path, savefig()
  • Inline plots and a live canvas in Jupyter

Rust

  • Pure-Rust spectra-plot crate, no C++ toolchain
  • Same figures, series, streaming and export as Python
  • Topics and knobs for live tools

How Fast?

Time to redraw one 1600x900 line plot, rendered offscreen and read back to the CPU (median of 30 frames, lower is better). Dense lines are reduced to what the screen can show without dropping a single spike, so the cost stays flat as data grows.

PointsSpectramatplotlibpyqtgraphSpectra, streaming
10k1.3 ms13.2 ms7.2 ms1.4 ms
100k1.2 ms23.5 ms10.7 ms2.4 ms
1M1.2 ms46.3 ms36.6 ms10.6 ms
10M1.2 ms230.2 ms219.7 ms84.5 ms

NVIDIA RTX 5080, Ryzen 9 9950X3D, Windows 11, Python 3.12, Spectra 0.4.1. Full table and method in the README; run bench_compare.py on your own hardware.

Architecture Diagrams

Visual maps for runtime topology, GPU pipeline, and live topics.

Browse by Topic

Prefer smaller pages? Use these focused guides.

Core Rendering

GPU Pipeline

  • Explicit Vulkan resource and frame management
  • Asynchronous uploads and multi-buffered rendering
  • Depth-tested rendering with optional 4x MSAA

2D Plot Quality

  • Anti-aliased lines with SDF smoothing
  • 17 marker shapes and dash patterns
  • MATLAB-style format strings (e.g., "r--o")

3D Visualization

Series + Shading

  • LineSeries3D, ScatterSeries3D, SurfaceSeries, MeshSeries
  • Blinn-Phong lighting and material controls
  • Colormaps: Viridis, Plasma, Inferno, Magma, Jet, Coolwarm, Grayscale

Camera + Scene

  • Quaternion-based orbit camera with pan/zoom
  • Wireframe mode and transparency sorting
  • 3D axes, grids, bounding box, depth-aware tick labels

Easy API (MATLAB-style)

Start with one-liners, scale to full object control when needed.

2D + Statistical

  • plot(), scatter(), subplot()
  • histogram(), bar(), box_plot(), violin()
  • Axis titles, labels, limits, legends, and styling helpers

3D + State Access

  • plot3(), scatter3(), surf(), mesh()
  • Window + tab helpers (figure(), tab())
  • MATLAB-like accessors (gcf(), gca(), cla())

Animation & Recording

Real-time Engine

  • Frame callbacks with configurable FPS
  • Stable frame scheduling + delta-time updates
  • Live streaming append paths

Timeline Tools

  • Timeline editor with play/pause/scrub
  • 7 keyframe interpolation modes
  • Curve editor with tangent controls

Output Formats

  • PNG sequences
  • GIF export with built-in quantization
  • MP4 export through ffmpeg pipeline

UI & Productivity

Workflow Acceleration

  • Command palette (Ctrl+K)
  • Custom shortcuts with JSON persistence
  • Undo/redo with grouped operations

Workspace Management

  • Multi-figure tabs and tab context operations
  • Docking + split panes + drag-to-dock
  • Workspace save/load with backward compatibility

Data Interaction

Exploration

  • Nearest-point hover tooltips
  • Crosshair overlays with axis labels
  • Persistent data markers

Coordination

  • Multi-axis linking across subplots
  • Shared cursor + interpolated Y readout
  • Linked zoom/pan/auto-fit behaviors

Transform Pipeline

  • 14 built-in data transforms
  • Chained transform pipelines
  • Custom transform registration

Themes & Accessibility

Theme System

  • Dark and light themes
  • Design tokens for spacing, color, typography
  • Theme export/import in JSON

Accessible Visualization

  • 8 colorblind-safe palettes
  • CVD simulation modes
  • WCAG contrast utilities

Multi-Window & Multi-Process

Window Runtime

  • Independent OS windows with per-window swapchains
  • Tab tear-off into new windows
  • Stable figure ownership with FigureId

Dual Runtime Modes

  • In-process mode for local app workflows
  • Multi-process mode: backend daemon + window agent
  • Protocol-driven state sync and diffs

Python API

Core API

  • Easy one-liners: spectra.plot(), spectra.scatter(), spectra.show()
  • matplotlib-style spectra.pyplot: subplots, errorbar, imshow, twinx, savefig
  • pandas DataFrames and Series, datetime axes, 3D plot3(), surf()

Performance + Streaming

  • Thread-safe live streaming with spectra.live()
  • NumPy arrays sent as one contiguous block
  • Inline PNGs and an interactive canvas in Jupyter

Export & Integration

Headless Rendering

  • Offscreen PNG, SVG and PDF for CI and servers
  • Export dialog with size, DPI, theme and transparency

Packaging

  • CMake install + find_package(spectra)
  • Linux, macOS, Windows release artifacts
  • apt repository, AppImage, Homebrew formula, AUR PKGBUILD, Python wheels

Optional Extensions

  • FFmpeg-backed MP4 export flag
  • Optional Eigen adapters
  • Plugin API for external command extensions

Quality & Reliability

Verification

  • Nearly 7,000 unit tests
  • Golden image regression tests for 2D and 3D
  • Integration tests + benchmarks

CI + Release

  • Cross-platform CI (Linux/macOS/Windows)
  • Sanitizer jobs and release packaging
  • Automated artifact publishing workflows

Quick Start

#include <spectra/easy.hpp>

int main() {
    std::vector<float> x = {0.f, 1.f, 2.f, 3.f};
    std::vector<float> y = {0.f, 1.f, 0.5f, 1.5f};

    spectra::plot(x, y, "c-o").label("example");
    spectra::title("Spectra Feature Demo");
    spectra::xlabel("X");
    spectra::ylabel("Y");
    spectra::show();
}

Python (Linux and macOS; on Windows use WSL2):

pip install spectra-plot
import numpy as np
import spectra as sp

x = np.linspace(0, 10, 500)
sp.plot(x, np.sin(x), "r--", label="sin")
sp.title("Hello Spectra")
sp.show()

Rust:

use spectra_plot::{linspace, Session};

let session = Session::new()?;
let ax = session.figure("Hello")?.subplot(1, 1, 1)?;
let x = linspace(0.0, 10.0, 500);
let y: Vec<f64> = x.iter().map(|v| v.sin()).collect();
ax.plot(&x, &y, "r--")?;
session.show()?;

More in the Getting Started guide and the examples.