I adjusted a simple example for this and posted it as a github gist [1]. It consists of the .ui file and the python script with the __main__ function and application class. First you want to add a plot to your graphicsView, and then make sure you refer to your graphicsView existing in your QMainWindow when calling plot(), not pg.plot(). Let me know if you have any questions!
[1] https://gist.github.com/chrismullins/0b9599bee313e52cdc95115af2492fe7 On Friday, June 23, 2017 at 7:48:21 PM UTC-4, [email protected] wrote: > > 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 > -- 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/e12e7ae4-31b0-46c2-a1ae-0bf9a67e472b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
