Skip to main content

Monkeypatch for pyqtgraph==0.11.0 resulting in superior OpenGL performance in contrast to more recent 0.11.1 to 0.12.3

Project description

https://img.shields.io/pypi/v/dvg-pyqtgraph-monkeypatch https://img.shields.io/badge/License-MIT-purple.svg

DvG_PyQtGraph_Monkeypatch

Monkeypatch for pyqtgraph==0.11.0 resulting in superior OpenGL performance in contrast to more recent 0.11.1 to 0.12.3

This monkeypatch is safe to import and will only get applied when it detects the correct PyQtGraph version pyqtgraph == 0.11.0. For other versions it will not affect anything at all. Also, when not using OpenGL in experimental mode, nothing changes.

Installation:

pip install dvg-pyqtgraph-monkeypatch

Reason for monkeypatch

This patch is intended for PyQtGraph with OpenGL acceleration enabled as such:

import pyqtgraph as pg
import OpenGL.GL as gl  # pylint: disable=unused-import
pg.setConfigOptions(useOpenGL=True)
pg.setConfigOptions(enableExperimental=True)
pg.setConfigOptions(antialias=True)

Above code will enable OpenGL acceleration within PyQtGraph and adds anti-aliasing to the chart curves. However, from versions 0.11.0 to 0.12.2 it will not draw the linewidth of the curves correctly and they remain at 1 pixel width, regardless of the set linewidth. This patch fixes the linewidth issue.

Why do I fix the PyQtgraph version for this monkeypatch to 0.11.0? Several reasons:

  • 0.11.0 draws the axis tick labels at the borders of the pyqtgraph.PlotWidget nicely, without cutting them off mid-way of the label itself. From 0.11.1 and up the tick labels will be cut off when they are at the border. That can be very confusing when reading the graph.

  • The most recent version at time of writing (0.12.3) actually has fixed the linewidth issue. However, the previous problem on the tick labels still applies.

  • It appears that 0.11.0 has superior plotting performance in frames per second / CPU load in contrast to 0.12.0 and up. This was confirmed and tested in another of my projects https://github.com/Dennis-van-Gils/DvG_Arduino_lock-in_amp. There is a different method used to render the graphs in OpenGL in these more recent PyQtGraph versions.

Usage

You only have to import the module into your Python code after you have imported PyQtGraph. That’s all. The patch will then be applied automatically.

import dvg_monkeypatch_pyqtgraph  # pylint: disable=unused-import

Changelog

2.0.0 (2022-01-20)

  • Turned into a separate PyPi package with proper documentation.

1.0.0 (?)

  • First but unreleased version. Was bundled together with every separate project instead.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dvg-pyqtgraph-monkeypatch-2.0.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file dvg-pyqtgraph-monkeypatch-2.0.0.tar.gz.

File metadata

  • Download URL: dvg-pyqtgraph-monkeypatch-2.0.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.10

File hashes

Hashes for dvg-pyqtgraph-monkeypatch-2.0.0.tar.gz
Algorithm Hash digest
SHA256 17ef89b6ccb7fc8fe76a122da7fc0e030013929db5437407d5f87c1704b63cd1
MD5 f0b8e9a6cc3ffb5a7664b27ba03c672f
BLAKE2b-256 32ee8227deb0c4011a1854aa42bcc35214433e98495ccb8d7c2794a5d4469f2c

See more details on using hashes here.

File details

Details for the file dvg_pyqtgraph_monkeypatch-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: dvg_pyqtgraph_monkeypatch-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.10

File hashes

Hashes for dvg_pyqtgraph_monkeypatch-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f321c9268227c69c6ad30beabccbbdba4ec6100ae4139bc20066d41059423db
MD5 2f4f40e730fcdf3daac451ed5af7b54c
BLAKE2b-256 d910fbbce17935dd417e4af73c0e60c7e00c11e3c7582579f12172f8b685edad

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page