I need plotting an animated bar chart with pyqtgraph. With animate i mean a chart, which updates his values given by a serial port. For now, a not-animated plot will be enough. I would like to implement a plot which looks something like this:
My input data is given in a dict which looks like this: (Key=Timestamp, Value=Event)
{1604496095: 0, 1604496096: 4, 1604496097: 6, 1604496098: 8, 1604496099: 9, 1604496100: 7, 1604496101: 8 ... }
Unfortunately I can't offer a lot of code as I have not been able to create a diagram similar to the one in the picture. So far I only have the corresponding window
Thats my window for now:
from PyQt5 import QtGui, QtWidgets, QtCore
import pyqtgraph as pg
import sysclass Plotter(QtWidgets.QMainWindow):def __init__(self, *args):QtWidgets.QMainWindow.__init__(self, *args)self.setWindowTitle("Test-Monitor")self.setMinimumSize(QtCore.QSize(800, 400))self.setupUI()def setupUI(self):self.plot = pg.PlotWidget()self.plot.showGrid(x=True, y=True)self.plot.setLabel('left', 'Event')self.plot.setLabel('bottom', 'Time')self.setCentralWidget(self.plot)app = QtWidgets.QApplication(sys.argv)
plotter = Plotter()
plotter.show()
app.exec_()
I would appreciate a code example that uses pyqtgraph that comes close to the picture.