Calling setData() on GLLinePlotItem does not update GLViewWidget

44 views
Skip to first unread message

JJ D

unread,
Aug 20, 2020, 1:25:51 AM8/20/20
to pyqtgraph

Hello everyone!

I am currently writing a program using pyqtgraph that displays strain gauge readings sent over serial from an Arduino. My goal is to visualize the flex in the fuselage of a carbon fibre rocket our university team is building.

Modifying some of the 3d graph example code listed here, I was able to plot a line. Next I wanted to test that I could update the line live and at an acceptable frame rate. So I created a 3d numpy array, passed it to a GLLinePlotItem via setData() and iteratively updated the numpy array while calling setData() each time. Unfortunately the graph does not seem to update. I've done quite a bit of digging in the documentation, and from what I've read, setData() should automatically update the line on the graph.

My code is below. Let me know if you have any ideas, or can point me to documentation that will help learn how to do this properly. Also it needs to be run with "python3 -i <filename.py>" right now. Thanks!


strain_visualizer.py

JMA 1

unread,
Aug 20, 2020, 8:34:50 AM8/20/20
to pyqt...@googlegroups.com
Greetings,

I have not used the 3D plot, but the basic plot works well and you can plot at reasonably fast rates.  I've simulated 100 Hz update rates using a Worker thread and it appears to works well.  I did not look at your code to know if you are trying to visualize stress/strain in 3D.  Traditional type plotting (3 rows on a screen for x,y,z) would seem reasonable as you would want to analyze the data.  This is off topic, but if you get stuck try to focus on the problem you are trying to solve (for example capturing and analyzing; presenting fancy data is always secondary).

Cheers,
Justin

--
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 pyqtgraph+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/c8f4963f-b29c-4276-9bda-69ba930575fen%40googlegroups.com.

JJ De Rooy

unread,
Aug 20, 2020, 10:35:42 AM8/20/20
to pyqt...@googlegroups.com
That is a very good point about this being an unnecessary visual representation of the strain. A traditional plot of each dimension against time in 2d would suffice. Part of my reasoning for attempting this in 3d was a as a learning experience. For now, I think I will take your advice and write what I need from a 2d standpoint. 3d can come later when I improve my programming skills :D

Thanks for the help!

Reply all
Reply to author
Forward
0 new messages