Hi,

I'm assuming that you need to ensure the "z-order" of the items is correct 
(the lines need to be in front of the image). Either insert the image 
first, then the line plot (and then only update the plot with setData). Or 
specifically change the z-order with the 
setZValue(...) method of the GraphicsItems. This functionality is inherited 
from the Qt QGraphicsItem 
https://doc.qt.io/qt-5/qgraphicsitem.html#setZValue which is why it's hard 
to find...

Patrick



On Friday, 17 December 2021 at 7:48:58 am UTC+10:30 Ellito wrote:

> I have multiple items displayed on the pyqtgraph plotWidget, an image and 
> some lines. When I update the image, the line are also removed and not 
> displayed. Could someone advise a way to update the image without removing 
> the lines (I do not want to redraw the line again since it will delay the 
> real-time display)?
>
> Example:
> import numpy as np 
> import pyqtgraph as pq 
> img = np.random.rand(100,100) 
> itemShow = pg.ImageItem(img.T) 
> imgItem = imWidget.addItem(itemShow) 
> penL = pg.mkPen('r') 
> lineItem = imWidget.addLine(x=100, pen=penL)
>
> After I updating the imgItem , the line is disappeared at the window.
>
>

-- 
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/d223dacf-5e74-48ae-b58b-c8b1489a88d6n%40googlegroups.com.

Reply via email to