Unresponsive plotWidget after many updates

61 views
Skip to first unread message

Brandon du Toit

unread,
Jan 7, 2022, 2:39:21 AM1/7/22
to pyqtgraph
Hi,

I have two 2x3 QGridlayouts containing plotWidgets, each on a QTabWidget tab. I plot to and clear these plotWidgets frequently and after a few plot/clear sequences a random few of them lose their interactiveness. I can no longer interactively drag to pan them or scroll to zoom in/out on them. If I drag to pan or scroll to zoom, I have to switch to the other tab and back for the change to show on the plot.

I use plotWidget.clear() to clear the plots and plotWidget.plot() to plot traces. Using pyqtgraph v0.12.3, python3.8 64 bit PyQt5 v5.15.6

Thanks

Martin Chase

unread,
Jan 7, 2022, 3:38:06 PM1/7/22
to pyqt...@googlegroups.com
Hey,

If it's possible, modifying the data in place and calling `PlotWidget.update()` is much more performant, rather than clearing and re-plotting each time. I started investigating the plot/clear behavior, and indeed see occasional lockups and possibly even a leak of some sort, but the modify-in-place architecture doesn't seem to suffer from the same.

Here's an example of what I mean:
x = np.linspace(0, 0.8, numpts)
y = np.random.random(size=numpts) * 0.8
plot.plot(x=x, y=y)
# ... later, we modify in place
y[:] = np.random.random(size=numpts) * 0.8
plot.update()
Reply all
Reply to author
Forward
0 new messages