Hi Diego,
With pg.plot (
http://www.pyqtgraph.org/documentation/functions.html#pyqtgraph.plot) you
create a new PlotWindow every time you start this function, but you need to
create them just one time and then fill with setData (
http://www.pyqtgraph.org/documentation/graphicsItems/plotcurveitem.html#pyqtgraph.PlotCurveItem.setData)
function. So, you are overloading (probably) ViewBox with lots of a new
plots.
You should do something like this:
// initalize the PlotWindows
self.pg_plot_one_1 = self.pg_plot_one.plot()
self.pg_plot_one_2 = self.pg_plot_one.plot()
then in a loop:
self.pg_plot_one.setRange(xRange=range(self.n)[d:]) // maybe this line
not need in a loop. look at
http://www.pyqtgraph.org/documentation/graphicsItems/viewbox.html#pyqtgraph.ViewBox.setRange
self.pg_plot_one_1.setData(self.y1[d:], pen=(1, 3), antialias=True)
self.pg_plot_one_2.setData(self.y2[d:], pen=(2, 3), antialias=True)
Of course, it is the best that you make combination you need.
Good luck,
Vasilije
On Sun, Dec 15, 2019 at 9:01 AM Diego Fernando <[email protected]> wrote:
>
> Hi guys,
>
> I'm trying to plot in real time several data in different plots. At firts
> it works great but after some time the window blocks but keeps plotting the
> data.
>
> I'm getting the data from a thread. and the code I'm using to plot looks
> like this:
>
> self.pg_plot_one.plot(
> range(self.n)[d:],
> self.y1[d:],
> pen=(1, 3),
> antialias=True,
> name="x axis"
> )
> self.pg_plot_one.plot(
> range(self.n)[d:],
> self.y2[d:],
> pen=(2, 3),
> antialias=True,
> name="y axis"
> )
>
>
> Any suggestions?
>
> Thanks
>
> --
> 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/ab3365fa-e10e-4d3f-8561-2788c81707fc%40googlegroups.com
> <https://groups.google.com/d/msgid/pyqtgraph/ab3365fa-e10e-4d3f-8561-2788c81707fc%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/CAD_qyJqvZ-QU3-WwM_bV344EA1JFx%2BdUHDwiYZEB%3DZjo0LNMKA%40mail.gmail.com.