PlotItem downsampling problem: Plot "glitches"

27 views
Skip to first unread message

Gergely Bálint

unread,
Aug 10, 2021, 4:41:27 AM8/10/21
to pyqt...@googlegroups.com

 

Hello everyone!

 

Im trying to put together a system, where I can plot data read from files in real time.

 

I wrote some code starting from the scrolling plot examples.

 

The correct plot is attached as the correct_plot.png file.

 

I have downsampling on:

                curve.setDownsampling(ds=100, method="subsample")

All other downsampleing methods caused glitching when I resized the plot window.

 

Inside the update() function I check if the files is ready (another process writes to these files):

 

    # if the next file doesnt exist, the current is still being written to

    if not os.path.exists(next_file_name):

        print("File is not ready yet")

        return

 

But whenever I reach this state, the plot starts glitching again. (See glitch.png)

 

I don’t know what causes this. The update() function should run similarly, as this check is at the beginning, and if the file isn’t ready, I simply return from it.

See my code attached as well.

 

Sidenote:

                I’ve seen this Github issue: ScrollingPlots Plot 3 Not Functioning · Issue #1916 · pyqtgraph/pyqtgraph · GitHub

                Apparently making scrolling plots shouldn’t be done using SetPos(). What should I use instead?

 

What am I doing wrong? If I change – or remove – the downsampling, it just gets worse, and the glitching starts even in “normal” conditions, e.g. without returning prematurely because the file isn’t ready.

 

Thanks in advance,

 

Gergely

correct_plot.png
glitch.png
pyqt_client.py.txt
Reply all
Reply to author
Forward
0 new messages