Skip to content

donghoonpark/FieldView

Repository files navigation

FieldView

Quality Tests Ruff Checked with mypy

FieldView is a high-performance Python library for 2D data visualization, built on top of the Qt framework. It is designed to efficiently render irregular data points using heatmaps, markers, and text labels.

FieldView leverages QtPy to support PySide6, PyQt6, and PyQt5, providing a flexible and robust solution for integrating advanced visualizations into Python desktop applications.

FieldView Demo

Key Features

  • High-Performance Heatmaps: Utilizes hybrid RBF (Radial Basis Function) interpolation for smooth, high-quality visualization of scattered data.
  • Irregular Data Handling: Natively supports non-grid data points without requiring pre-processing.
  • Flexible Masking: Supports arbitrary boundary shapes (Polygon, Circle, Rectangle) for precise clipping.
  • Modular Layer System:
    • HeatmapLayer: Renders interpolated data with customizable colormaps.
    • ValueLayer / LabelLayer: Displays text with automatic collision avoidance.
    • PinLayer: Visualizes data points with markers.
    • SvgLayer: Renders SVG backgrounds for context (e.g., floor plans, maps).
  • Minimal Dependencies: Core functionality relies only on numpy, scipy, and qtpy.

Performance

FieldView's FastRBFInterpolator is designed for real-time rendering. By precomputing the interpolation matrix, it achieves significant speedups during the rendering phase.

Benchmark Plot

Note: FastRBF requires a one-time setup cost to accelerate subsequent frame rendering.

Installation

Install FieldView with your preferred Qt binding:

pip install fieldview[pyside6]  # Recommended
# OR
pip install fieldview[pyqt6]
# OR
pip install fieldview[pyqt5]

Requires Python 3.10+

Quick Start

FieldView provides a high-level FieldView widget for easy integration.

import sys
import numpy as np
from qtpy.QtWidgets import QApplication
from fieldview import FieldView

app = QApplication(sys.argv)

# 1. Prepare Data
points = np.random.rand(20, 2) * 400
values = np.random.rand(20) * 100

# 2. Create FieldView
view = FieldView()
view.resize(800, 600)
view.set_data(points, values)

# 3. Add Layers
view.add_heatmap_layer(opacity=0.6)
view.add_pin_layer()
view.add_value_layer()

# 4. Show
view.show()
view.fit_to_scene()

sys.exit(app.exec())

Examples

To explore the full capabilities, including the property inspector and real-time updates, run the included demo:

# Using uv (recommended)
uv run examples/demo.py

License

This project is licensed under a hybrid model depending on the Qt binding used:

  • LGPLv3: When used with PySide6.
  • GPLv3: When used with PyQt6 or PyQt5.

Please ensure compliance with the license of the chosen Qt binding.

About

python-qt based non-regular data visualization library

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors