Skip to main content

ShenBi (神笔)

matplotlib syntax + pyqtgraph performance

ShenBi is a high-performance Python plotting library that provides the familiar matplotlib API while leveraging pyqtgraph's GPU-accelerated rendering engine. Write code like you do with matplotlib, get the speed of pyqtgraph.

Why ShenBi?

matplotlib pyqtgraph ShenBi
API friendliness Excellent Complex Excellent (matplotlib-compatible)
Performance Slow on large data Very fast Very fast (pyqtgraph engine)
Interactivity Limited Rich (pan/zoom) Rich (built-in)
GPU acceleration No Yes (OpenGL) Yes (inherited)
Auto-downsampling No Yes Yes (automatic)

Quick Start

import numpy as np
import shenbi.pyplot as plt

# Generate 1 million data points
x = np.linspace(0, 100, 1_000_000)
y = np.sin(x) + 0.1 * np.random.randn(1_000_000)

# Use familiar matplotlib syntax
plt.figure(figsize=(12, 4))
plt.plot(x, y, 'b-', linewidth=1, label='Signal')
plt.title('1 Million Points — Rendered Instantly')
plt.xlabel('Time')
plt.ylabel('Amplitude')
plt.grid(True)
plt.legend()
plt.show()

Features

Line Plots

plt.plot(x, y, 'r-', linewidth=2, label='Line')
plt.plot(x, y2, 'b--', marker='o', markersize=4)

Scatter Plots

plt.scatter(x, y, s=10, c='darkorange', alpha=0.5, marker='o')

Bar Charts

plt.bar(['A', 'B', 'C', 'D'], [23, 45, 12, 67], color='steelblue')

Histograms

plt.hist(data, bins=50, color='green', alpha=0.7)

Subplots

fig, axes = plt.subplots(2, 2, figsize=(10, 8))
axes[0, 0].plot(x, np.sin(x), 'r-')
axes[0, 1].plot(x, np.cos(x), 'b-')
axes[1, 0].bar([0, 1, 2, 3], [10, 20, 15, 25])
axes[1, 1].hist(np.random.randn(5000), bins=30)

Format Strings

Supports matplotlib-style format strings: 'r-o', 'b--', 'g.', 'k:', etc.

Other Features

  • plt.title(), plt.xlabel(), plt.ylabel()
  • plt.xlim(), plt.ylim(), plt.xscale('log')
  • plt.grid(), plt.legend()
  • plt.axhline(), plt.axvline(), plt.text()
  • plt.errorbar(), plt.fill_between(), plt.imshow()
  • plt.savefig() for image export

Installation

pip install pyqtgraph numpy
# Then either PyQt5, PyQt6, PySide2, or PySide6:
pip install PySide6
git clone https://github.com/CodeOfMe/ShenBi.git
cd ShenBi
pip install -e .

Requirements

  • Python >= 3.9
  • pyqtgraph >= 0.13.0
  • numpy >= 1.20
  • Qt bindings: PyQt5, PyQt6, PySide2, or PySide6

Performance

ShenBi inherits pyqtgraph's multi-level performance optimizations:

  • Automatic downsampling: When viewing large datasets, points are automatically decimated based on screen pixel density
  • Clip-to-view: Only data within the visible view range is processed for rendering
  • GPU acceleration: When using OpenGL-backed widgets, vertex data is uploaded to GPU via VBOs for hardware-accelerated rendering
  • Segmented line rendering: Fast QPainter.drawLines() used when beneficial

Rendering 1 million data points takes ~1 second on CPU, virtually instant on GPU.

Architecture

User Code (matplotlib-style API)
        │
        ▼
   shenbi.pyplot  ──  State-based API (plt.plot, plt.figure, etc.)
        │
        ▼
   ShenBiFigure   ──  Wraps pyqtgraph GraphicsLayoutWidget
        │
        ▼
   ShenBiAxes     ──  Wraps pyqtgraph PlotItem
        │
        ▼
   ShenBiLine2D   ──  Wraps pyqtgraph PlotDataItem
        │
        ▼
   pyqtgraph      ──  High-performance Qt-based rendering engine

License

MIT

Metadata

Release files for shenbi 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shenbi 0.1.1
File Size Uploaded Provenance
shenbi-0.1.1.tar.gz 13.2 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for shenbi 0.1.1
File Interpreter ABI Platform
shenbi-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.3 MB

Release files / shenbi-0.1.1.tar.gz

Download URL shenbi-0.1.1.tar.gz
Size 13.2 MB
Tags Source
SHA-256 checksum
How to use checksums
15ff7678dd2ba6a623690cf916955f8d9093a271f3188200f4afeb0ba397cca5
BLAKE2b-256 checksum
How to use checksums
8c229e63a9a422122a6bad30823d09857b718de52fb45cd0f2abaeff0331be75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / shenbi-0.1.1-py3-none-any.whl

Download URL shenbi-0.1.1-py3-none-any.whl
Size 65.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cca54713cd2c03f5a4328d9487773bcdf853e7004e69fa5340cafeb8e99527d7
BLAKE2b-256 checksum
How to use checksums
9550f9ed08ecdd2f40b7c58d389fa565f9648e7a095052d7d8cb74e19b8badd2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Security for shenbi 0.1.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page