I'm currently working on a real time display system using pyqtgraph/anaconda3 and I'm having trouble optimizing the code to not clog the cpu. I'm currently plotting 600 points at all times * 2 sets of data per plot * 21 plots of data which is roughly 25000 points at all times. The code struggles to handle that many points (it crashes at 500s due to cpu maxing out at 100% running this code alone) and I'm willing to cut it to 300 points of data per dataset (5 minutes of real time data which is barely meeting our purpose of analyzing real time data), but even plotting 300 points clogs up ~60% of our cpu on an industrial computer which is not optimal since we're running other software at the same time (this code if possible can only take up ~20% of our cpu). This code reads data from another program that's processing the data, but for testing purposes a dummy file is being uses to simulate it.
So I'm hoping that instead of redrawing the whole plot from scratch, there's an alternative to 'append' new points to an already drawn graph and only have to redraw the plot every 10 secs instead of every second (which is how often I receive new data). Y axis - data, X axis - time(seconds).
If that's confusing I'm hoping for
0 - > 300 points hopefully being appended to avoid cpu clogging
when 300 points is plotted -> clear() -> plot the last 290 points and append the next 10 values
repeat until program ends.
Any advice / alternatives will be much appreciated. I've attached my code for reference.