0

such as the code below. I don't know what to do at all QAQ

In official documents I only found the method of exporting static plot, and I can't find more information on the internet .

It seems that pyqtgraph is deeply relevent with QT. But I am not familiar with that.

import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
import numpy as np

win = pg.GraphicsLayoutWidget(show=True)
win.setWindowTitle('Scrolling Plots Mode 1')

p1 = win.addPlot()
data1 = np.random.normal(size=300)

curve1 = p1.plot(data1)


def update1():
    global data1, ptr1
    data1[:-1] = data1[1:]  # shift data in the array one sample left
    # (see also: np.roll)
    data1[-1] = np.random.normal()
    curve1.setData(data1)


timer = pg.QtCore.QTimer()
timer.timeout.connect(update1)
timer.start(50)


## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
    import sys

    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()

  • There is no builtin method, which will save dynamic plot as a video. You have to first export Your plot as a image and then create video frame by frame using ffmpeg for example. Here is similar question to Yours already answered: https://stackoverflow.com/questions/48558572/exporting-pyqtgraph-to-video – Domarm Feb 01 '22 at 18:45

0 Answers0