What is the easiest way to achieve real time graph in pyqtgraph

I do not understand how to achieve real-time display in pyqtgraph. The implementation of this is not yet implemented in the documentation.

Can anyone suggest a simple example?

+4
source share
1 answer

Pyqtgraph only allows you to draw in real time, quickly drawing new chart data. How to achieve a real-time schedule is highly dependent on the details and control flow in your application.

The most common ways are:

  • Graph data in a loop that calls QApplication.processEvents ().

    pw = pg.plot() while True: ... pw.plot(x, y, clear=True) pg.QtGui.QApplication.processEvents() 
  • Use QTimer to repeatedly call a function that updates the schedule.

     pw = pg.plot() timer = pg.QtCore.QTimer() def update(): pw.plot(x, y, clear=True) timer.timeout.connect(update) timer.start(16) 
+18
source

Source: https://habr.com/ru/post/1495531/


All Articles