Skip to content
github-actions[bot] edited this page Mar 23, 2026 · 19 revisions

FastPlot — Home

Ultra-fast time series plotting for MATLAB and GNU Octave with dynamic downsampling, sensor monitoring, and dashboard layouts.

Key Metrics

Metric Value
10M point zoom cycle 4.7 ms (212 FPS)
Point reduction 99.96% (10M to ~4K displayed)
GPU memory (10M pts) 0.06 MB vs 153 MB for plot()
Implementation Pure MATLAB + optional C MEX (AVX2/NEON SIMD)

Library Components

FastPlot consists of five integrated libraries:

Library Description
FastSense Core plotting engine with dynamic downsampling, dashboard layouts (FastSenseGrid, FastSenseDock), interactive toolbar, themes, and disk-backed storage via FastSenseDataStore
Dashboard Widget-based dashboard engine with 8+ widget types, 24-column responsive grid, edit mode, and JSON persistence
SensorThreshold Sensor data containers with state-dependent threshold rules, violation detection, and SensorRegistry catalog
EventDetection Event detection from threshold violations, EventViewer with Gantt timeline, live pipeline with notifications
WebBridge TCP server for web-based visualization with NDJSON protocol

Features

  • Smart downsampling — per-pixel MinMax and LTTB algorithms, auto-selected per zoom level
  • Pyramid cache — multi-resolution pre-computation for instant zoom-out on 50M+ datasets
  • MEX acceleration — optional C with SIMD (AVX2/NEON), auto-fallback to pure MATLAB
  • Dashboard layouts — tiled grids (FastSenseGrid) and tabbed containers (FastSenseDock)
  • Interactive toolbar — data cursor, crosshair, grid/legend toggle, autoscale, PNG export
  • 6 built-in themes — default, dark, light, industrial, scientific, ocean
  • Linked axes — synchronized zoom/pan across subplots
  • Sensor system — state-dependent thresholds with condition-based rules and violation markers
  • Event detection — group violations into events with statistics, Gantt viewer, click-to-plot
  • Live mode — file polling with auto-refresh (preserve/follow/reset view modes)
  • Disk-backed storage — SQLite-backed chunked DataStore for 100M+ point datasets
  • Web bridge — TCP/REST/WebSocket interface for external web dashboards

Quick Start

Installation

install;  % Add all libraries to path and compile MEX acceleration

Basic Plot

% Plot 10M points with threshold and violation markers
fp = FastSense('Theme', 'dark');
x = linspace(0, 100, 1e7);
y = sin(x) + 0.1 * randn(size(x));
fp.addLine(x, y, 'DisplayName', 'Sensor');
fp.addThreshold(0.8, 'Direction', 'upper', 'ShowViolations', true, 'Label', 'High');
fp.render();

Tiled Dashboard

% Multi-tile dashboard with spanning
fig = FastSenseGrid(2, 2, 'Theme', 'dark');
fig.setTileSpan(1, [1 2]);  % Top tile spans 2 columns

fp1 = fig.tile(1);
fp1.addLine(x, sin(x), 'DisplayName', 'Pressure');
fp1.addBand(0.8, 1.0, 'FaceColor', [1 0.3 0.3], 'FaceAlpha', 0.15, 'Label', 'Alarm');
fig.setTileTitle(1, 'Pressure Monitor');

fp2 = fig.tile(2);
fp2.addLine(x, cos(x), 'DisplayName', 'Temperature');
fig.setTileTitle(2, 'Temperature');

fp3 = fig.tile(3);
fp3.addLine(x, randn(size(x))*5, 'DisplayName', 'Vibration');
fig.setTileTitle(3, 'Vibration');

fig.renderAll();

Sensors with State-Dependent Thresholds

% Sensor with mode-dependent alarms
s = Sensor('pressure', 'Name', 'Chamber Pressure');
s.X = linspace(0, 100, 1e6);
s.Y = 50 + 10*randn(1, 1e6);

% Machine state (0=idle, 1=running, 2=shutdown)
sc = StateChannel('machine_state');
sc.X = [0 30 60 80];
sc.Y = [0 1 2 1];
s.addStateChannel(sc);

% Different thresholds per state
s.addThresholdRule(struct('machine_state', 1), 70, 'Direction', 'upper', 'Label', 'Run HI');
s.addThresholdRule(struct('machine_state', 2), 75, 'Direction', 'upper', 'Label', 'Shutdown HI');
s.resolve();

fp = FastSense('Theme', 'industrial');
fp.addSensor(s, 'ShowThresholds', true);
fp.render();

Event Detection

% Detect and visualize threshold violation events
cfg = EventConfig();
cfg.addSensor(sensor_obj, sensor_time, sensor_data);
cfg.MinDuration = 0.5;  % Ignore violations < 0.5 seconds
events = cfg.runDetection();

% Interactive viewer with Gantt timeline and click-to-plot
viewer = EventViewer(events);

Architecture Overview

graph TB
    subgraph FastSense["FastSense (Core Plotting)"]
        FS["FastSense<br/>Dynamic Downsampling"]
        BS["Binary Search<br/>O(log n)"]
        MMD["MinMax Downsample<br/>2×pixel_width points"]
        LTTB["LTTB Downsample<br/>Shape-preserving"]
        PYR["Pyramid Cache<br/>Multi-resolution"]
    end
    
    subgraph SensorThreshold["SensorThreshold<br/>(Monitoring)"]
        SEN["Sensor<br/>Time-series + Rules"]
        STATE["StateChannel<br/>Discrete States"]
        RULE["ThresholdRule<br/>Conditions + Values"]
        REG["SensorRegistry<br/>Catalog"]
    end
    
    subgraph EventDetection["EventDetection<br/>(Analysis)"]
        DET["EventDetector<br/>Violation Grouping"]
        EVENTS["Event Objects<br/>Statistics"]
        VIEWER["EventViewer<br/>Gantt + Table"]
    end
    
    subgraph Dashboard["Dashboard<br/>(Layouts)"]
        GRID["FastSenseGrid<br/>Tiled Layout"]
        DOCK["FastSenseDock<br/>Tabbed Layout"]
        ENG["DashboardEngine<br/>Widget-based"]
        WIDGETS["8+ Widget Types<br/>Number, Gauge, Status..."]
    end
    
    subgraph WebBridge["WebBridge<br/>(Web Interface)"]
        TCP["TCP Server<br/>NDJSON Protocol"]
        REST["REST API<br/>Data Queries"]
        WS["WebSocket<br/>Live Streaming"]
    end
    
    FS --> BS
    FS --> MMD
    FS --> LTTB
    FS --> PYR
    SEN --> RULE
    SEN --> STATE
    SEN --> FS
    DET --> EVENTS
    EVENTS --> VIEWER
    SEN --> DET
    GRID --> FS
    DOCK --> GRID
    ENG --> WIDGETS
    WIDGETS --> FS
    DET --> ENG
    FS --> TCP
    TCP --> REST
    TCP --> WS
Loading

Performance Pipeline

  1. Data Input — Raw time-series (1K to 100M points)
  2. Binary Search — O(log n) to find visible X range
  3. Pyramid Level Selection — Pick cached level matching zoom level (~100x reduction per level)
  4. Downsampling — MinMax or LTTB reduces visible slice to ~4K points
  5. Graphics Update — Reuse line handles, direct XData/YData assignment
  6. Frame Rate Capdrawnow limitrate at 20 FPS

Result: 4.7 ms zoom cycles (212 FPS) on 10M points with 99.96% point reduction.


Requirements

  • MATLAB R2020b+ or GNU Octave 7+
  • C compiler (optional) for MEX acceleration (GCC on Linux/Octave, LLVM/clang on macOS, MSVC on Windows)
  • No toolbox dependencies — pure MATLAB implementation with graceful MEX fallback

Documentation

Getting Started

API Reference

Specialized Guides

Use Cases


Architecture Diagram

sequenceDiagram
    participant User as User Code
    participant FS as FastSense
    participant BS as binary_search<br/>(MEX/MATLAB)
    participant Downsample as minmax_downsample<br/>(MEX/MATLAB)
    participant Render as MATLAB Graphics

    User->>FS: fp.addLine(x, y)
    User->>FS: fp.addThreshold(value)
    User->>FS: fp.render()
    FS->>Render: Create figure/axes
    FS->>Render: hLine = line(x, y)
    
    activate Render as Zoom/Pan
    User->>Render: Drag axes xlim
    deactivate
    
    Render->>FS: onXLimChanged callback
    FS->>BS: idx_start = binary_search(X, xmin)
    BS-->>FS: idx_start
    FS->>BS: idx_end = binary_search(X, xmax)
    BS-->>FS: idx_end
    FS->>Downsample: [xd, yd] = minmax_downsample(X_visible, Y_visible)
    Downsample-->>FS: ~4000 points
    FS->>Render: set(hLine, 'XData', xd, 'YData', yd)
    Render->>User: Display updated line
Loading

Quick Links

Task Resource
Install cd fastplot && install;
Run examples run_all_examples
Run tests run_all_tests
Build MEX build_mex
Read docs Getting-Started
40+ examples Examples

Community & Support

FastPlot is an open-source MATLAB library for high-performance time series visualization. Issues, feature requests, and contributions are welcome.

Citation:

@software{fastplot2024,
  title = {FastPlot: Ultra-Fast Time Series Plotting for MATLAB},
  author = {FastPlot Contributors},
  year = {2024},
  url = {https://github.com/fastplot/fastplot}
}

Clone this wiki locally