Hi Vasilije,

I used your suggestions and made a small test. I still have exception 
("len(X) must be len(Y)+1 since stepMode=True (got (0L,) and (0L,))") when 
I zoom in/out my plot. In attachment is my test case scenario. 


On Tuesday, February 7, 2017 at 5:38:18 PM UTC+1, Marija Zupunski wrote:
>
> Hi guys,
>
> I would like to draw plot items using stepMode=True and after that I would 
> like to use setDownsampling() and setClipToView(). I have exception when i 
> send data saying that:
>
> "len(X) must be len(Y)+1 since stepMode=True"
>
> I set length of x and y values, but still I have the same exception when I 
> call setDownsampling() and setClipToView()
>
> My code is something like this:
>
>
> # len(x_value) == len(y_value)
>
> self.subplot.plot(x=signal.x_value, y=signal.y_value[:-1], pen=signal.color, 
> name=signal.name, stepMode=True)
> self.subplot.setDownsampling(ds=True, auto=False, mode='peak')
> self.subplot.setClipToView(clip=True)
>
>
>
> Is there something wrong that I am doing? 
>

-- 
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/1fd9e9c4-db81-40a0-8ac1-50d3e2cd48c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
import numpy as np
from random import *

win = pg.GraphicsWindow()
win.setWindowTitle('pyqtgraph example: Scrolling Plots')


randBinList = lambda n: [randint(0, 1) for b in range(1, n+1)]


p1 = win.addPlot()

data1 = np.random.normal(size=300)
data2 = randBinList(300)

curve1 = p1.plot(data1)
curve2 = p1.plot(stepMode=True)
curve2.setData(y=data2, x=range(len(data2) + 1))


p1.setClipToView(True)
p1.setDownsampling(ds=True, auto=False, mode='peak')


## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
    import sys

    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()

Reply via email to