Hi Stefan,

Have you tried giving the x,y data to the plot curve when it is created
instead of creating it then using setData? Like so:

curves = [0]*len(y)
for i in range(0,len(y)):
            if headers[i][0:3] == 'fit':
                print('try')
                curves[i] = self.p.plot(x, y[i], pen='r',name='happy') #
crashes
            else:
                curves[i] = self.p.plot(x, y[i],
pen=None,symbol='o',name=headers[i],
symbolSize=1, symbolPen=self.colors[i]) # works
                print('hi')
            #curves[i].setData(x, y[i])

On Fri, Jan 24, 2020 at 6:52 AM Stefan Wijnbelt <
[email protected]> wrote:

> Part of the code:
> curves = [0]*len(y)
> for i in range(0,len(y)):
>             if headers[i][0:3] == 'fit':
>                 print('try')
>                 curves[i] = self.p.plot(pen='r',name='happy') # crashes
>             else:
>                 curves[i] =
> self.p.plot(pen=None,symbol='o',name=headers[i], symbolSize=1,
> symbolPen=self.colors[i]) # works
>                 print('hi')
>             curves[i].setData(x, y[i])
> x is a list of the time (floats)
> y is a list of list of data to plot (floats)
> headers is a list of headers (string)
> self.colors is a list of RGB colors (tupples)
>
> The code crashes on
> curves[i] = self.p.plot(pen='r',name='happy') # crashes
>
> While
> curves[i] = self.p.plot(pen=None,symbol='o',name=headers[i], symbolSize=1,
> symbolPen=self.colors[i]) # works
> works just fine
>
>
> Error:
> Traceback (most recent call last):
>   File
> "C:\Python37\lib\site-packages\pyqtgraph\graphicsItems\PlotCurveItem.py",
> line 174, in boundingRect
>     (xmn, xmx) = self.dataBounds(ax=0)
>   File
> "C:\Python37\lib\site-packages\pyqtgraph\graphicsItems\PlotCurveItem.py",
> line 131, in dataBounds
>     b = (np.nanmin(d), np.nanmax(d))
>   File "<__array_function__ internals>", line 6, in nanmin
>   File "C:\Python37\lib\site-packages\numpy\lib\nanfunctions.py", line
> 320, in nanmin
>     res = np.fmin.reduce(a, axis=axis, out=out, **kwargs)
> TypeError: cannot perform reduce with flexible type
>
>
> --
> 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/8ba67b76-5542-4f4a-8766-fcdd5c1426b8%40googlegroups.com
> <https://groups.google.com/d/msgid/pyqtgraph/8ba67b76-5542-4f4a-8766-fcdd5c1426b8%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAOTkkr5xjB2T-Oez6vAo4o0XuzXZscRvSOzeCe7PfL_f660ypQ%40mail.gmail.com.

Reply via email to