Hi everyone.

I have a question to ask about PlotItem and its background customization.

My current situation is:
- I have an ImageItem that shows a stream of images
- An overlayed PlotItem with some stats
- An overlayed TextItem with some stats too

What I would like to do is add a sort of opaque background to the PlotItem 
and the TextItem to make the graph axes and the writings more readable, 
something like half transparent white background.

Is it possible?

Here is a little snippet of my current code in the __init__ method, maybe 
it could help

        QtCore.QObject.__init__(self)
        
        app = QtGui.QApplication([])
        
        # Create window with GraphicsView widget
        win = pg.GraphicsLayoutWidget()
        win.show()  ## show widget alone in its own window
        win.setWindowTitle('Realtime prediction')

                 # Create ViewBox
        self.view = win.addViewBox(enableMouse=False)
        self.view.invertY()
        self.view.setAspectLocked(True)
        
        # Create image item
        self.vis = pg.ImageItem()
        self.view.addItem(self.vis)
        
        # Create obstacle histogram
        plot = pg.PlotItem() # <- background here
        plot.layout.setMinimumWidth(200.0)
        plot.layout.setMinimumHeight(150.0)      
        axesB = plot.getAxis('bottom')
        axesB.setTicks([xdict.items()])
        axesB.setPen((0, 0, 0))
        axesL = plot.getAxis('left')
        axesL.setPen((0, 0, 0))
        plot.setZValue(10)
        plot.setY(320.0)
        plot.setX(220.0)
        self.view.addItem(plot)
        
        self.barGraphItem = pg.BarGraphItem(x = x, height = self.y, width = 
1, brush = (255, 0, 0, 128))
        plot.addItem(self.barGraphItem)
        
        self.text = pg.TextItem('Loading...') # <- background here
        self.text.setColor((0.5, 0.5, 0.5))
        self.view.addItem(self.text)

        QtGui.QApplication.instance().exec_()


Thank you in advance for the answers.

Toni.

-- 
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/35239600-85c4-4a6c-a1b6-b2138ff0b583%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to