PyQtLabGraph
An embeddable live plotting widget for PySide6/Qt6 applications, built on PyQtGraph.
PyQtLabGraph adds the pieces that lab and instrument software needs on top of a fast plot: a toolbar, an external legend, measurement cursors, a live-preview Customize dialog, SI-aware axes, curve palettes, and JSON layout persistence. Each piece is a separate Qt widget, so host applications can arrange them freely.
Development status: PyQtLabGraph is an alpha-stage 0.x project. Public APIs and saved layout formats may change between minor releases before 1.0.
Previews
| Light Theme (Default) | Dark Theme |
|---|---|
| Modeless Customize Dialog | Modular Widget Layout |
|---|---|
[1] Plot Widget • [2] External Legend Widget • [3] Plot Toolbar Widget |
| Cursor Inspector and Measurements |
|---|
Why PyQtLabGraph?
- Matplotlib produces excellent static figures but is not built for fast live data streams.
- PyQtGraph is very fast, but deliberately leaves toolbars, legends, customize dialogs, and layout persistence to the host application.
PyQtLabGraph keeps PyQtGraph's performance and supplies that application layer, similar to the ready-made graph controls of instrument software such as LabVIEW or an oscilloscope front panel:
- Ready-made controls: zoom, per-axis autoscale, rolling window, export, and customization work without extra host code.
- Explicit themes: light, dark, and solarized plot themes that are chosen by the host, while toolbar, legend, and dialogs follow the host's Qt style and palette.
- Modular widgets: plot, toolbar, legend, and cursor panel are independent Qt widgets that fit into any layout or Qt Designer placeholder.
Features
- Real-Time Plotting: High-performance rendering optimized for rapid updates, live sensor streams, or fast oscilloscope-style displays.
- Scientific Color Tools: Ten categorical curve palettes and ten continuous gradients for ordered or scalar-mapped curve coloring.
- Alpha Trace Persistence: Bounded, reusable fading-history pools for repeated full oscilloscope-style acquisitions.
- Smart Axis Formatting (
SmartAxisItem):AUTO: Automatic SI-prefix scaling (e.g., scaling raw Hertz tokHz/MHz/GHz).LINEAR: Explicit raw values with user-defined units, bypassing auto-scaling.TIME: Adaptive relative time formatting displaying seconds formatted elegantly asd h min sdepending on zoom level.
- Dedicated External Legend (
PyQtLabGraphLegend):- Displays curve symbols, colors, and labels.
- Interactive: Double-click a curve's legend item to open the Customize dialog immediately focused on that curve. Single-click to toggle curve visibility.
- Configurable orientation: Can be placed vertically (default) or horizontally.
- Cursor Widget:
- Adds movable X/Y cursors with a compact, host-styled inspector for cursor color, type, name, value, visibility, and optional snap target values.
- Remains an optional standalone component that the host can place beside or below a plot, in a dock, or in any other Qt layout.
- Supports direct cursor value editing, context-menu creation, deletion, and pairing, copyable rows, and a cursor settings dialog for name, visibility, labels, snapping, and line style.
- X cursors can snap to a target curve and report the matching Y target value.
- Selecting a cursor highlights its plot label in the cursor color; clicking a label in the plot selects the cursor in the list.
- Cursor rows can be reordered by dragging between rows or dragged onto another cursor of the same axis to form a measurement pair. A pair is displayed as one draggable group containing two independently selectable cursor rows and a dedicated delta measurement bar. The group background selects both cursors for synchronous movement; the result eye controls the annotation, and its plot position can be dragged and persisted with the layout.
- Integrated Toolbar:
- Show All, rectangle zoom, X zoom, and Y zoom.
- Autoscale toggles for the X and Y axes individually.
- Rolling X window with a configurable size.
- PNG export and direct access to the Customize dialog.
- Monochrome SVG icons that follow the toolbar's Qt palette and stay sharp on HiDPI screens.
- Modeless Customize Dialog:
- Adjust titles, labels, units, axis formatting modes, and logarithmic scaling from grouped axis sections.
- Toggle grids, global anti-aliasing, downsampling, clip-to-view, and adaptive performance.
- Manage individual curves in per-curve tabs with grouped curve, line, marker, and trace-persistence controls.
- Edit line width, line colors, marker styles (circle, square, cross, diamond, etc.), size, and borders.
- Live Preview: Axes, appearance, rendering, and curve edits preview immediately. View ranges preview explicitly through Preview Range or Enter so partially typed values do not move the plot.
- Clear Commit Actions: Apply & Close keeps the current preview, Save Layout saves it without closing, and Cancel restores the state from when the dialog was opened or last saved.
- Layout Persistence: Save and load visual properties, theme, active palette, ranges, curve styles, trace persistence, cursors, and cursor pairs in a shared, strictly versioned JSON file that holds several plots.
- Adaptive Performance: Automatic visual simplification when rendering very dense datasets to avoid UI lag.
Interactive Controls
PyQtLabGraph introduces advanced viewport mouse controls on top of the standard PyQtGraph mouse interactions:
- Mouse Drag (Left Click): Pans the view, or draws the zoom region when a zoom tool is active.
- Mouse Drag (Right Click): Zooms X and Y scale dynamically (drag left/right for X, up/down for Y).
- Mouse Wheel: Zooms both X and Y axes centered on the cursor position.
- Shift + Mouse Wheel: Zooms X-axis only, preserving the Y-axis range.
- Ctrl + Mouse Wheel: Zooms Y-axis only, preserving the X-axis range.
- Double Click Axis: Opens a quick manual range pop-up directly underneath the cursor for entering exact values.
Installation
PyQtLabGraph requires Python 3.11 or newer.
Install PyQtLabGraph from PyPI:
pip install pyqtlabgraph
Or install it directly from the repository source:
pip install .
For an editable development installation including the test, lint, type-check, and build tools:
python3 -m pip install -e ".[dev]"
Quick Start
Here is a minimal working example of embedding the PyQtLabGraphWidget inside a basic Qt window:
import sys
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QApplication, QHBoxLayout, QMainWindow, QVBoxLayout, QWidget
from pyqtlabgraph import (
PyQtLabGraphCursorWidget,
PyQtLabGraphLegend,
PyQtLabGraphToolbar,
PyQtLabGraphWidget,
)
app = QApplication(sys.argv)
window = QMainWindow()
central = QWidget()
layout = QHBoxLayout(central)
window.setCentralWidget(central)
plot = PyQtLabGraphWidget(
plot_identifier="quickstart_plot",
)
toolbar = PyQtLabGraphToolbar(plot)
legend = PyQtLabGraphLegend(plot, orientation=Qt.Orientation.Horizontal)
cursors = PyQtLabGraphCursorWidget(plot)
plot_column = QVBoxLayout()
plot_column.addWidget(toolbar)
plot_column.addWidget(plot, stretch=1)
plot_column.addWidget(legend)
layout.addLayout(plot_column, stretch=1)
layout.addWidget(cursors)
# Plot a simple sensor temperature curve
plot.plot(
key="temp_sensor",
x=[0, 1, 2, 3, 4, 5],
y=[22.1, 22.4, 23.0, 22.8, 23.5, 24.1],
label="Temperature",
)
# Set axis labels and units
plot.set_axis_labels(
x_label="Time", x_units="s",
y_label="Temperature", y_units="°C"
)
# Add editable cursors; every cursor panel follows plot signals.
plot.cursors.add("x", key="time_cursor", name="Time Cursor", value=2.0)
plot.cursors.add("y", key="temperature_cursor", name="Temperature Cursor", value=23.0)
window.resize(800, 600)
window.show()
sys.exit(app.exec())
Run the bundled examples directly from a source checkout:
- Minimal Demo:
python examples/demo_minimal.py - Thermostat Simulation Demo:
python examples/demo_thermostat.py - Time Domain & FFT Demo:
python examples/demo_time_fft.py - Cursor Demo:
python examples/demo_cursor.pyShows the freely embeddable cursor widget as a right-hand inspector, including direct value editing, snapping to a target curve, cursor settings, deletion, pairing, and layout persistence.
Every demo starts in Light mode. Use View → Dark mode to switch the host application, plot background, and curve palette together. The demos use Qt Fusion with explicit Light and Dark palettes so interactive theme changes remain consistent across supported platforms.
Detailed Documentation
- 📖 API Reference: Complete details on classes, parameters, and methods.
- 🧭 Architecture: Ownership, component boundaries, update flow, and regression guardrails.
- 🎨 Visual Styling & Themes: Built-in themes, curve palettes, and integrating with host stylesheets.
- ⚡ Performance Optimization: Downsampling, clip-to-view, and adaptive rendering mechanics.
Project Structure
├── pyqtlabgraph/ # Main library package
│ ├── __init__.py # Public exports & versioning
│ ├── widget.py # Main PyQtLabGraphWidget and API wrapping
│ ├── dispatch.py # Ordered updates, coalescing, and atomic resets
│ ├── runtime_state.py # Exact runtime snapshots for rollback
│ ├── curve_manager.py # Curve metadata, data, and PlotDataItem lifecycle
│ ├── range_controller.py # Autoscale, rolling, and manual range policy
│ ├── render_optimizer.py # Rendering flags and Adaptive Performance
│ ├── style_controller.py # Plot-owned theme and curve appearance
│ ├── cursors.py # plot.cursors: cursor state, pairs, snapping, and selection
│ ├── cursor_presenter.py # Plot graphics, annotations, and label layout
│ ├── cursor_plot_items.py # PyQtGraph InfiniteLine cursor adapters
│ ├── cursor_widget.py # Public cursor panel and user-intent handling
│ ├── cursor_list_model.py # Read projection plus typed edit/drop intents
│ ├── cursor_ui.py # Shared cursor UI records, roles, and geometry
│ ├── cursor_delegate.py # Host-styled cursor row painting and editors
│ ├── cursor_actions.py # Cursor context-menu and action construction
│ ├── cursor_settings.py # Cursor settings dialog
│ ├── dialogs.py # Modeless Customize dialog composition
│ ├── customize_controls.py # Customize controls and curve editors
│ ├── customize_session.py # Customize preview, save, and rollback session
│ ├── layouts.py # Layout model, strict type-driven codec, storage, and reconciliation
│ ├── toolbar.py # Toolbar buttons, export, and mode controllers
│ ├── legend.py # External interactive PyQtLabGraphLegend
│ ├── axis.py # SmartAxisItem tick formatting implementation
│ ├── axis_editors.py # Double-click axis range pop-up
│ ├── interaction.py # ViewBox mouse and wheel interaction
│ ├── persistence.py # Alpha trace persistence pools
│ ├── constants.py # Shared internal thresholds and defaults
│ ├── models.py # Core dataclasses (CurveState, InteractionState)
│ ├── styles.py # Individual curve style configuration
│ ├── colormaps.py # Categorical palettes and continuous gradients
│ ├── themes.py # Background themes and color registries
│ ├── style_registry.py # Explicit appearance-value resolution
│ ├── qt_styles.py # Palette-aware native frame painting
│ └── assets/ # SVG icon assets used by the toolbar
├── docs/ # Detailed user-facing documentation
├── tests/ # Pytest suite, wheel checks, and README screenshot generator
├── examples/ # Source-checkout demos and examples
├── .github/workflows/ # CI and release workflows
└── pyproject.toml # Build system and package metadata
Development & Verification
Install the project in editable mode with its development tools:
python3 -m pip install -e ".[dev]"
Run the complete local verification suite after changes:
python3 -m pytest -q
ruff check pyqtlabgraph tests examples
mypy pyqtlabgraph
python3 -m build
CI runs the same checks on Python 3.11, 3.12, and 3.13. It also installs the built wheel into a clean virtual environment and verifies public exports, version metadata, typing metadata, and runtime SVG assets.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for pyqtlabgraph 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyqtlabgraph-0.3.0.tar.gz | 125.7 kB | With provenance | Details for pyqtlabgraph-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyqtlabgraph-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for pyqtlabgraph-0.3.0-py3-none-any.whl |
Total release size: 223.8 kB
Release files / pyqtlabgraph-0.3.0.tar.gz
| Download URL | pyqtlabgraph-0.3.0.tar.gz |
|---|---|
| Size | 125.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
592ffb9b1d070b66accde41c87e1e5fe70a99b03b279a268ebd438ca6646ba24
|
|
BLAKE2b-256 checksum How to use checksums |
b14a1aadc193f7b5c45dcc058c0ec00d377c1d057156c80f50bd83be8653b48a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.
Transparency logRelease files / pyqtlabgraph-0.3.0-py3-none-any.whl
| Download URL | pyqtlabgraph-0.3.0-py3-none-any.whl |
|---|---|
| Size | 98.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f1732650635da4d658d5599959f7b58ea7a6b5d8a730eea805c4dff89878f3ce
|
|
BLAKE2b-256 checksum How to use checksums |
1e41afeee59c3f7dc7fd2aacbdced5f72e8c30374558bfe5956957ba62dfa711
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.
Transparency logSecurity for pyqtlabgraph 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pyqtlabgraph-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.