Pyqtgraph not autoranging graph correctly?

343 views
Skip to first unread message

Ian Reischauer

unread,
Apr 2, 2021, 4:57:31 AM4/2/21
to pyqtgraph
 Hi! I'm using pyqtgraph with pyqt5 for a gui. I have a slight issue in that I have now enable autorange so that I dont manually have to adjust the axis. What I do is that after I have buffered enough elements (say 250) I start popping old data at the start of the list and pushing new data to the end to keep a fixed list size of 250.

 Problem is that the autorange seems to think that my list is growing and although it displays the correct data, the x-axis grows.

So in effect the displayed data is being updated and displayed, but the x axis is only adjusting the range to incorporate the new data(thus growing the x-axis in the positive direction) but not adjusting the x-axis to account for the data that has been removed/popped from the start of the list.

I have a feeling I'm incorrectly incorporating something, however I cant figure out where my error is.

Any help will be appreciated!

Ian Reischauer

unread,
Apr 2, 2021, 5:01:37 AM4/2/21
to pyqtgraph
Just to maybe explain this better:

When my list has the following elements x = [0:250], it is displayed correctly on the x axis as [0:250], but then data is added/removed from my list, so later on my list still has a length of 250 elements but the elements are x = [750:1000]
so my hope is the graph will display only these elements on the x axis, however the x -axis is ranged from 0:1000 and the displayed data is only in the range of 750:1000 with the range of 0:750 being blank

Carlos Pascual-Izarra

unread,
Apr 6, 2021, 4:06:56 AM4/6/21
to pyqt...@googlegroups.com

Hi,

I think you just need to change the way you update the data. Have a look at the 1st plot of the ["Scrolling Plots" example](https://github.com/pyqtgraph/pyqtgraph/blob/master/examples/scrollingPlots.py)

I hope this helps.


Carlos

--
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/9d8ca8c9-25df-4163-8477-04bd3316af4bn%40googlegroups.com.

  
Reply all
Reply to author
Forward
0 new messages