0

I am using pyqtgraph but whatever I am doing I am stuck with the following bug: for any plots, axes and plot is flickering and I cannot see anything. I put a GIF to show my problem and the corresponding code

import pyqtgraph as pg
from PySide6.QtWidgets import QApplication, QMainWindow
import sys
import numpy as np

app = QApplication(sys.argv)

win = QMainWindow()
plot_widget = pg.PlotWidget()
win.setCentralWidget(plot_widget)

x = np.linspace(0, 10, 1000)
y = np.sin(x)
plot_widget.plot(x, y)

win.show()
sys.exit(app.exec())

os : Ubuntu 22.04.5 LTS.
Python env:

  • Python 3.10.13
  • pyqtgraph, Version: 0.13.7
  • PySide6, Version: 6.9.1
  • numpy, Version 2.2.6

I assume it is a rendering issue related to the system and not Python or code logic since I tried using code from basic tutorial which led to different output than the one expected in the tutorial (ex. first plot of this page)

I tried several backend by setting QT_QPA_PLATFORM env variable to xcb or wayland but did not work.

I tried this settings at the begining of my script, but it did not work.

os.environ["QT_QPA_PLATFORM"] = "xcb"
os.environ["QT_OPENGL"] = "software"
os.environ["LIBGL_ALWAYS_SOFTWARE"] = "1"

Link to the gif https://gifyu.com/image/bKIQU

5
  • as I remeber SO allows to put animated GIF directly in question and it will display it as animation - so it can be more useful. But it may need to reduce size of image, and maybe you may need more points of reputation. Commented Jul 14 at 14:55
  • code works correctly for me with PyQt6 but it has problem with PySide6 - Linux Mint 22 (based on Ubuntu 24.04), Python 3.13.5, numpy: 2.3.1, pygtgraph: 0.13.7, Commented Jul 14 at 15:50
  • it seems other people had different problems with PySide6 + pyqtgraph - so it may need to use PyQt6: python - Recursion Error using pyqtgraph with PySide6 - Stack Overflow Commented Jul 14 at 16:05
  • issue on pyqtgraph repo: PySide/QT version 6.9.1 incompatiblity · Issue #3328 · pyqtgraph/pyqtgraph Commented Jul 14 at 16:07
  • Yes as @furas pointed out, the problem comes from Pyside6 version (6.9.1). After downgrading to 6.9.0 it worked for me. Commented Jul 14 at 18:23

2 Answers 2

1

Yes as @furas pointed out, the problem comes from Pyside6 version (6.9.1). After downgrading to 6.9.0 it worked for me. There is an issue here https://github.com/pyqtgraph/pyqtgraph/issues/3328

Sign up to request clarification or add additional context in comments.

1 Comment

Your answer is very correct and perfectly solved my problem. I just used pip install PySide6==6.9.0 instead of version 6.9.1, and everything became better.
0

Okay so I here is the easiest approach, just change from importing QtWidgets by PySide6 and use PyQt6 instead it works just fine as shared in the image snapshot of the pyqtgraph code

from PyQt6 import QtWidgets

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.