I did this part promoting “PlotWidget” :
1. In Designer, create a QGraphicsView widget (“Graphics View” under the “Display Widgets” category).
2. Right-click on the QGraphicsView and select “Promote To...”.
3. Under “Promoted class name”, enter the class name you wish to use (“PlotWidget”, “GraphicsLayoutWidget”, etc).
4. Under “Header file”, enter “pyqtgraph”.
5. Click “Add”, then click “Promote”.
Now, I am trying to plot in the GraphicsView.
self.pushButton.clicked.connect(self.btn_clk)
MainWindow.show()
def btn_clk(self):
L = [1,2,3,4,5]
pg.plot(L)
If I use this above, the plot shows up in a new window.
My question is: how can I plot in the GraphicsView instead of a new window.
I tried several different variations of getPlotItem(), but it didn't work.
Thanks very much.
Cheers,
Joe