pythonpyside6pyqtgraph

pyqtgraph not working on example in pythonGUIs website - PySide6 with pyqtgraph


I am trying the example from PythonGUIs website using this script:

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

class MainWindow(QMainWindow):

    def __init__(self):
        super().__init__()

        self.graphWidget = pg.PlotWidget()
        self.setCentralWidget(self.graphWidget)

        hour = [1,2,3,4,5,6,7,8,9,10]
        temperature = [30,32,34,32,33,31,29,32,35,45]

        # plot data: x, y values
        self.graphWidget.plot(hour, temperature)


app = QApplication(sys.argv)
w = MainWindow()
w.show()
app.exec()

For some reason its just giving me a blank ui plot

Are the versions not compatible or is there something wrong somewhere?

Versions:

Python = 3.13.5

pyqtgraph = 0.13.7

PySide6 = 6.9.1


Solution

  • It is a bug with PySide 6.9.1 (see the report: PYSIDE-3115). It's already marked as fixed for the forthcoming 6.9.2 and future 6.10.

    That specific version has been blacklisted for pyqtgraph a few days ago.

    PySide 6.9.1 should be avoided and considered as unreliable/unstable due to this issue. If you can, at the very least downgrade to 6.9.0.
    The 6.8 branch doesn't seem to be affected since the change causing the problem was introduced in the 6.9 branch, so you may consider downgrading to 6.8.3 as well (being it a higher patch/build version of a minor version, it is probably more stable and reliable than a 0 patch/build version of a higher minor one). Be aware, though, that that change was caused by another bug found in 6.8.3, probably existing in previous versions too.

    For simple usage, both downgrade options may be acceptable depending on your needs, but the criticality of the related bugs should also be considered along with that of new features and changes introduced since 6.9.

    PyQt doesn't seem to be affected, therefore you can try to install it as an alternative. If you really need PySide and cannot downgrade, you can still use PyQt temporarily, until PySide 6.9.2 is officially released (due in a couple of months).