p2.plot(np.random.normal(size=100), pen=(255,0,0), name="Red curve")
p2.plot(np.random.normal(size=110)+5, pen=(0,255,0), name="Blue curve")
p2.plot(np.random.normal(size=120)+10, pen=(0,0,255), name="Green curve")
<snip>
Can someone please demonstrate the procedure to now remove one of these curves?
Everything I've tried, except for clear() which removes everything in the plot window, either throws and attribute exception or does nothing.
Thanks.
Thanks.
p2 = win.addPlot(title="Multiple curves")
c1 = p2.plot(np.random.normal(size=100), pen=(255,0,0), name="Red curve")
c2 = p2.plot(np.random.normal(size=110)+5, pen=(0,255,0), name="Blue curve")
c3 = p2.plot(np.random.normal(size=120)+10, pen=(0,0,255), name="Green curve")
print type( p2 ) #<class 'pyqtgraph.graphicsItems.PlotItem.PlotItem.PlotItem'>
print type( c1 ) #<class 'pyqtgraph.graphicsItems.PlotDataItem.PlotDataItem'>
#So each curve is a PlotDataItem (PlotDataItem.py) with its own clear() method so
c1.clear()
#OOPS, I just noticed that some_curve.clear() only clears the data content
#and PlotItem.py has a removeItem() method to remove the curves entirely from the viewbox so:
p2.removeItem( c2 )