How to paint the inside of a rectangular ROI

32 views
Skip to first unread message

JJ

unread,
May 17, 2019, 4:59:12 AM5/17/19
to pyqtgraph
I want to programatically draw a ROI on the plot that has a color fill. However, it should be rendered behind the plotted data.
I would also like to change the line style of the edges.
How can this be done?

Patrick

unread,
May 21, 2019, 2:34:44 AM5/21/19
to pyqtgraph
Hi,

You may need to create your own ROI subclass, for example, a copy/paste of one of the existing RectROI, set a brush and use a fillRect instead of drawRect. The pen can be passed in on the ROI constructor to change its style, or tweak it afterwards using the standard QPen methods.
To draw behind plot data, then you can play with calling setZValue(10) on the ROI and/or plot items.

Patrick
Reply all
Reply to author
Forward
0 new messages