G'day,

I've written a basic line plotter which holds ~10s (600 data points at 
60Hz) worth of data, which continuously scrolls to the left to mimic a 
real-time data feed.

I've done this by populating a list, which appends new data each iteration, 
whilst removing the same number of data points from the beginning of the 
list. I've also added some threshold lines (an upper and lower), as well as 
an x-axis line. The below code should give an indication as to the approach 
I've taken:

Plot = pyqtgraph.PlotWidget()



DataList = []
for x in range(0, 600):
    DataList.append(DataSource[x])


Plot.clear()
curve = Plot.plot([float(i) for i in DataList], clickable=False)


LowerThresholdList = []
UpperThresholdList = []
XAxisList = []


for x in range(0, 600):
    LowerThresholdList.append(float(LowerThresholdValue))
    UpperThresholdList.append(float(UpperThresholdValue))


    XAxisList.append(0)


Plot.plot(LowerThresholdList, pen=(255,165,0))

Plot.plot(UpperThresholdList, pen=(255,0,0))
Plot.plot(XAxisList)



I played with InfiniteLines in place of the threshold and x-axis lines, but 
prefer how the above lines don't reach the y axis, whereas the InfiniteLine 
continues all the way to the axis (as the name would suggest).

When I run the above on my development machine, it works perfectly, with 
the plot updating and scrolling at the full 60Hz refresh rate. When I 
deploy the software to my embedded device (currently prototyping on a 
Raspberry Pi 2 with EGLFS and OpenGL-enabled), the entire UI becomes 
sluggish beyond about 1Hz. My question: is the above approach the best way 
of achieving a real-time scrolling line plot? Is replacing the threshold 
and x axis plots with InfiniteLines a faster/more efficient approach? The 
aim is to have full 60Hz scrolling updates of the data on the embedded 
device; if the above approach/selection of PlotWidget/etc. isn't suitable, 
can you please point me in the right direction?

Many thanks,

Jamie

-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/475a8259-49dd-4e7f-a4b1-889d1dfd52ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to