コード例 #1
0
 def __init__(self, plot: pg.PlotItem, parent: QWidget):
     super().__init__(parent)
     self.setWindowTitle('Plot detail')
     # Get all items in the plot
     gItems = plot.listDataItems()
     # Create a new plot and set its position in the scatterplot matrix (col and row parameters)
     nPlot = pg.PlotItem()
     nPlot.addLegend(pen=pg.mkPen(.8, width=1))
     nPlot.row = plot.row
     nPlot.col = plot.col
     # Move all the items from the original plot to the new plot
     for it in gItems:
         nPlot.addItem(it)
     nPlot.setLabel(axis='left', text=plot.yName)
     nPlot.setLabel(axis='bottom', text=plot.xName)
     # Make a plot widget to hold the PlotItem
     self.plotWidget = pg.PlotWidget(parent=self, plotItem=nPlot)
     self.plotWidget.setCentralItem(nPlot)
     self.plotItem = nPlot
     # Show the plot in a new window
     self.setWindowFlag(Qt.Window)
     # Layout is needed
     QHBoxLayout(self).addWidget(self.plotWidget)
コード例 #2
0
 def onPlotClosed(self, plot: pg.PlotItem) -> None:
     nPlot = self.getItem(plot.row, plot.col)
     for item in plot.listDataItems():
         nPlot.addItem(item)