Python pyqtgraph 模块,ArrowItem() 实例源码

我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用pyqtgraph.ArrowItem()

项目:InplusTrader_Linux    作者:zhengwsh    | 项目源码 | 文件源码
def initplotKline(self):
        """Kline"""
        self.pw2 = pg.PlotWidget(name='Plot2')  # K??
        self.vbl_2.addWidget(self.pw2)
        self.pw2.setDownsampling(mode='peak')
        self.pw2.setClipToView(True)

        self.curve5 = self.pw2.plot()
        self.curve6 = self.pw2.plot()

        self.candle = self.CandlestickItem(self.listBar)
        self.pw2.addItem(self.candle)
        ## Draw an arrowhead next to the text box
        # self.arrow = pg.ArrowItem()
        # self.pw2.addItem(self.arrow)

    #----------------------------------------------------------------------
项目:InplusTrader_Linux    作者:zhengwsh    | 项目源码 | 文件源码
def plotText(self):
        """?????"""
        lenClose = len(self.listClose)

        if lenClose >= 5:                                       # Fractal Signal
            if self.listClose[-1] > self.listClose[-2] and self.listClose[-3] > self.listClose[-2] and self.listClose[-4] > self.listClose[-2] and self.listClose[-5] > self.listClose[-2] and self.listfastEMA[-1] > self.listslowEMA[-1]:
                ## Draw an arrowhead next to the text box
                # self.pw2.removeItem(self.arrow)
                self.arrow = pg.ArrowItem(pos=(lenClose-1, self.listLow[-1]), angle=90, brush=(255, 0, 0))
                self.pw2.addItem(self.arrow)
            elif self.listClose[-1] < self.listClose[-2] and self.listClose[-3] < self.listClose[-2] and self.listClose[-4] < self.listClose[-2] and self.listClose[-5] < self.listClose[-2] and self.listfastEMA[-1] < self.listslowEMA[-1]:
                ## Draw an arrowhead next to the text box
                # self.pw2.removeItem(self.arrow)
                self.arrow = pg.ArrowItem(pos=(lenClose-1, self.listHigh[-1]), angle=-90, brush=(0, 255, 0))
                self.pw2.addItem(self.arrow)

    #----------------------------------------------------------------------
项目:kite    作者:pyrocko    | 项目源码 | 文件源码
def __init__(self, model):
        pg.GraphicsWidget.__init__(self)
        pg.GraphicsWidgetAnchor.__init__(self)

        self.model = model

        self.arrow = pg.ArrowItem(
            parent=self,
            angle=0.,
            brush=(0, 0, 0, 180),
            pen=(255, 255, 255),
            pxMode=True)
        self.orientArrow()

        self.model.sigSceneChanged.connect(self.orientArrow)
        self.setFlag(self.ItemIgnoresTransformations)
项目:FoundryDataBrowser    作者:ScopeFoundry    | 项目源码 | 文件源码
def setup(self):

        self.settings.New('spec_index', dtype=int, initial=0)
        self.settings.spec_index.add_listener(self.on_spec_index_change)

        self.settings.New("x_axis", dtype=str, initial='power_wheel', choices=('power_wheel', 'pm_power'))

        self.ui = QtWidgets.QGroupBox()
        self.ui.setLayout(QtWidgets.QVBoxLayout())

        self.ui.spec_index_doubleSpinBox = QtWidgets.QDoubleSpinBox()
        self.settings.spec_index.connect_bidir_to_widget(self.ui.spec_index_doubleSpinBox)
        self.ui.layout().addWidget(self.ui.spec_index_doubleSpinBox)

        self.ui.x_axis_comboBox = QtWidgets.QComboBox()
        self.settings.x_axis.connect_to_widget(self.ui.x_axis_comboBox)
        self.ui.layout().addWidget(self.ui.x_axis_comboBox)

        self.graph_layout = pg.GraphicsLayoutWidget()
        self.ui.layout().addWidget(self.graph_layout)

        self.power_plot = self.graph_layout.addPlot()
        self.power_plot.setLogMode(x=True, y=True)

        self.power_plotcurve = self.power_plot.plot([1],[1])

        self.power_plot_current_pos = self.power_plot.plot(symbol='o')
        #self.power_plot_arrow = pg.ArrowItem()
        #self.power_plot_arrow.setPos(0,0)
        #self.power_plot.addItem(self.power_plot_arrow)

        self.graph_layout.nextRow()

        self.spec_plot = self.graph_layout.addPlot()
        self.spec_plotcurve = self.spec_plot.plot([0])
项目:FoundryDataBrowser    作者:ScopeFoundry    | 项目源码 | 文件源码
def setup(self):

        self.settings.New('spec_index', dtype=int, initial=0)
        self.settings.spec_index.add_listener(self.on_spec_index_change)

        self.ui = QtWidgets.QGroupBox()
        self.ui.setLayout(QtWidgets.QVBoxLayout())

        self.ui.spec_index_doubleSpinBox = QtWidgets.QDoubleSpinBox()
        self.settings.spec_index.connect_bidir_to_widget(self.ui.spec_index_doubleSpinBox)
        self.ui.layout().addWidget(self.ui.spec_index_doubleSpinBox)

        self.graph_layout = pg.GraphicsLayoutWidget()
        self.ui.layout().addWidget(self.graph_layout)

        self.power_plot = self.graph_layout.addPlot()
        self.power_plot.setLogMode(x=True, y=True)

        self.power_plotcurve = self.power_plot.plot([1],[1], name='Data')

        self.power_fit_plotcurve = self.power_plot.plot([1],[1],pen='r', name='Fit')

        self.power_plot_arrow = pg.ArrowItem()
        self.power_plot_arrow.setPos(0,0)
        self.power_plot.addItem(self.power_plot_arrow)

        self.power_plot_lr = pg.LinearRegionItem([1,2])
        self.power_plot_lr.setZValue(-10)
        self.power_plot.addItem(self.power_plot_lr)
        self.power_plot_lr.sigRegionChanged.connect(self.redo_fit)

        #self.power_plot_legend = pg.LegendItem()
        #self.power_plot.addItem(self.power_plot_legend)
        #self.power_plot_legend.addItem(self.power_plotcurve)
        #self.power_plot_legend.addItem(self.power_fit_plotcurve)
        self.fit_text = pg.TextItem("fit")
        self.fit_text.setParentItem(self.power_plot_lr, )

        self.graph_layout.nextRow()

        self.spec_plot = self.graph_layout.addPlot()
        self.spec_plotcurve = self.spec_plot.plot([0])