def setup_graph(self): self.win = pg.GraphicsWindow() self.win.setMinimumSize(350, 350) self.graph_label = pg.LabelItem(justify='right') self.win.addItem(self.graph_label, row = 1, col=1) self.p1 = self.win.addPlot(row=2, col=1) self.p2 = self.win.addPlot(row=3, col=1) self.p1.vb.setMouseEnabled(x=False) # Add the LinearRegionItem to the ViewBox, but tell the ViewBox to exclude this # item when doing auto-range calculations. self.region = pg.LinearRegionItem() self.region.setZValue(10) self.p2.addItem(self.region, ignoreBounds=True) self.p1.setAutoVisible(y=True) #plot data self.curve1 = self.p1.plot() self.curve2 = self.p2.plot() plot_tools.graph_pyqt(self.curve1, self.curve2, self.data, self.dataview) #axes plot_tools.change_display_pyqt(self.p1, self.dataview) plot_tools.change_display_pyqt(self.p2, self.dataview) #add line inspection tool self.vLine_2 = pg.InfiniteLine(angle=90, movable=False) self.p1.addItem(self.vLine_2, ignoreBounds=True) self.p1.scene().sigMouseMoved.connect(self.mouseMoved_graph) return self.win
def setup_graph(self): self.win = pg.GraphicsWindow() self.win.setMinimumSize(350, 350) self.graph_label = pg.LabelItem(justify='right') self.win.addItem(self.graph_label, row=1, col=1) self.p1 = self.win.addPlot(row=2, col=1) self.p2 = self.win.addPlot(row=3, col=1) self.p1.vb.setMouseEnabled(x=False) # Add the LinearRegionItem to the ViewBox, but tell the ViewBox to exclude this # item when doing auto-range calculations. self.region = pg.LinearRegionItem() self.region.setZValue(10) self.p2.addItem(self.region, ignoreBounds=True) self.p1.setAutoVisible(y=True) #plot data self.curve1 = self.p1.plot() self.curve2 = self.p2.plot() plot_tools.graph_pyqt(self.curve1, self.curve2, self.data, self.dataview) #axes plot_tools.change_display_pyqt(self.p1, self.dataview) plot_tools.change_display_pyqt(self.p2, self.dataview) #add line inspection tool self.vLine_2 = pg.InfiniteLine(angle=90, movable=False) self.p1.addItem(self.vLine_2, ignoreBounds=True) self.p1.scene().sigMouseMoved.connect(self.mouseMoved_graph) return self.win
def update_graph(self): x = self.dataview.x y = self.dataview.y self.square.setPos((x, y)) plot_tools.graph_pyqt(self.curve1, self.curve2, self.data, self.dataview) self.update_control()
def update_graph(self): x = self.dataview.x y = self.dataview.y self.square.setPos((x,y)) plot_tools.graph_pyqt(self.curve1, self.curve2, self.data, self.dataview) self.update_control()