Animate a plot with PyQtGraph and OpenGL
One of the experiments I did as part of the old project I have recently written about was about animating a 3D plot using OpenGL from PyQtGraph. The code was inspired pretty much to one of the PyQtGraph examples from its GitHub repository, where – for future memory – the main components are the following:
- A Qt
QApplication
as the container Qt app. - A
GLViewWidget
as the main OpenGL view component. - A
GLGridItem
to visualize a grid (not essential). - A
GLScatterPlotItem
as the actual scatterplot graph. - A
QTimer
to repeatedly call anupdate
function, which includes two actions:setData
to plot the data pointsorbit
to make the camera spin around the view center (neat!)
I've recently revisited the example to put everything in a class rather than relying on global
s. I'll publish it at some point.