Search code examples
pythonpython-2.7pyqtgraph

Is it possible to use FillBetweenItem to fill between two PlotCurveItem's in pyqtgraph?


I'm attempting to fill between two curves that were created using PlotCurveItem in pyqtgraph.

            phigh = self.p2.addItem(pg.PlotCurveItem(x, y, pen = 'k'))           
            plow = self.p2.addItem(pg.PlotCurveItem(x, yy, pen = 'k'))           
            pfill = pg.FillBetweenItem(phigh, plow, brush = br)
            self.p2.addItem(pfill)

The curve items are plotting properly however there is no fill.


Solution

  • This fixed it.

                phigh = pg.PlotCurveItem(x, y, pen = 'k')           
                plow = pg.PlotCurveItem(x, yy, pen = 'k')                  
                pfill = pg.FillBetweenItem(ph, plow, brush = br)
                self.p2.addItem(ph)
                self.p2.addItem(plow)
                self.p2.addItem(pfill)