Skip to content Skip to sidebar Skip to footer

How To Make A Fast Matplotlib Live Plot In A Pyqt5 Gui

Some years ago, I already experimented with embedding live matplotlib plots in a PyQt5 GUI. Live plots show a data-stream real-time, captured from a sensor, some process, ... I got

Solution 1:

The second case (using FuncAnimation) is faster because it uses "blitting", which avoids redrawing things that do not change between frames.

The example provided on the matplotlib website for embedding in qt was not written with speed in mind, hence the poorer performance. You'll notice that it calls ax.clear() and ax.plot() at each iteration, causing the whole canvas to be redrawn everytime. If you were to use the same code as in the code with FuncAnimation (that is to say, create an Axes and an artist, and update the data in the artist instead of creating a new artists every time) you should get pretty close to the same performance I believe.

Post a Comment for "How To Make A Fast Matplotlib Live Plot In A Pyqt5 Gui"