当前位置: 首页>>代码示例>>Python>>正文


Python pyqtgraph.InfiniteLine方法代码示例

本文整理汇总了Python中pyqtgraph.InfiniteLine方法的典型用法代码示例。如果您正苦于以下问题:Python pyqtgraph.InfiniteLine方法的具体用法?Python pyqtgraph.InfiniteLine怎么用?Python pyqtgraph.InfiniteLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyqtgraph的用法示例。


在下文中一共展示了pyqtgraph.InfiniteLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add_tonic

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import InfiniteLine [as 别名]
def add_tonic(self, values):
        """
        Adds tonic lines on the pitch plot.

        :param values: (list or numpy array) A sequence of tonic values in Hz.

        """
        # label options for the tonic values on the tonic line
        label_opts = {'position': 0.1, 'color': (200, 200, 100),
                      'fill': (200, 200, 200, 50), 'movable': True}

        if not hasattr(self, 'tonic_lines'):
            self.tonic_lines = []

        for value in values:
            # create infinite line
            t_line = pg.InfiniteLine(pos=value, movable=False, angle=0,
                                     label='Tonic=%.2f' % value,
                                     labelOpts=label_opts)
            # take tonic lines in a list to remove in the future
            self.tonic_lines.append(t_line)
            self.zoom_selection.addItem(t_line)  # add item to zoom selection 
开发者ID:MTG,项目名称:dunya-desktop,代码行数:24,代码来源:timeserieswidget.py

示例2: test_getViewWidget_deleted

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import InfiniteLine [as 别名]
def test_getViewWidget_deleted():
    view = pg.PlotWidget()
    item = pg.InfiniteLine()
    view.addItem(item)
    assert item.getViewWidget() is view
    
    # Arrange to have Qt automatically delete the view widget
    obj = pg.QtGui.QWidget()
    view.setParent(obj)
    del obj
    gc.collect()

    assert not pg.Qt.isQObjectAlive(view)
    assert item.getViewWidget() is None


#if __name__ == '__main__':
    #view = pg.PlotItem()
    #vref = weakref.ref(view)
    #item = pg.InfiniteLine()
    #view.addItem(item)
    #del view
    #gc.collect() 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:25,代码来源:test_GraphicsItem.py

示例3: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import InfiniteLine [as 别名]
def __init__(self, plot):
        pg.HistogramLUTWidget.__init__(self, image=plot.image)
        self._plot = plot
        self.prev_levels = None
        self.symmetric_colormap = True

        zero_marker = pg.InfiniteLine(
            pos=0,
            angle=0,
            pen='w',
            movable=False)
        zero_marker.setValue(0.)
        zero_marker.setZValue(1000)
        self.vb.addItem(zero_marker)

        self.axis.setLabel('Displacement / m')
        # self.plot.rotate(-90)
        # self.layout.rotate(90)
        # self.gradient.setOrientation('bottom')
        self.setSymColormap()
        self._plot.image.sigImageChanged.connect(self.imageChanged)

        self.sigLevelsChanged.connect(self.symmetricLevels)
        # self.isoCurveControl() 
开发者ID:pyrocko,项目名称:kite,代码行数:26,代码来源:base.py

示例4: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import InfiniteLine [as 别名]
def __init__(self):
        pg.HistogramLUTWidget.__init__(self, image=None)
        self.plots = []

        self.axis.setLabel('Displacement / m')

        zero_marker = pg.InfiniteLine(
            pos=0,
            angle=0,
            pen='w',
            movable=False)
        zero_marker.setValue(0.)
        zero_marker.setZValue(1000)
        self.vb.addItem(zero_marker)

        self.axis.setLabel('Displacement / m')
        self.setSymColormap() 
开发者ID:pyrocko,项目名称:kite,代码行数:19,代码来源:multiplot.py

示例5: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import InfiniteLine [as 别名]
def __init__(self, plot, pen=None):
        """ Initiates the crosshars onto a plot given the pen style.

        Example pen:
        pen=pg.mkPen(color='#AAAAAA', style=QtCore.Qt.DashLine)
        """
        super().__init__()

        self.vertical = pg.InfiniteLine(angle=90, movable=False, pen=pen)
        self.horizontal = pg.InfiniteLine(angle=0, movable=False, pen=pen)
        plot.addItem(self.vertical, ignoreBounds=True)
        plot.addItem(self.horizontal, ignoreBounds=True)

        self.position = None
        self.proxy = pg.SignalProxy(plot.scene().sigMouseMoved, rateLimit=60,
                                    slot=self.mouseMoved)
        self.plot = plot 
开发者ID:ralph-group,项目名称:pymeasure,代码行数:19,代码来源:curves.py

示例6: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import InfiniteLine [as 别名]
def __init__(self,parent):
        """Constructor"""
        self.__view = parent
        
        super(Crosshair, self).__init__()
        self.__vLine = pg.InfiniteLine(angle=90, movable=False)
        self.__hLine = pg.InfiniteLine(angle=0, movable=False)
        self.__textPrice = pg.TextItem('price')
        self.__textDate = pg.TextItem('date')
        
        #mid 在y轴动态跟随最新价显示最新价和最新时间
        self.__textLastPrice = pg.TextItem('lastTickPrice')    
        
        view = self.__view
        
        view.addItem(self.__textDate, ignoreBounds=True)
        view.addItem(self.__textPrice, ignoreBounds=True)        
        view.addItem(self.__vLine, ignoreBounds=True)
        view.addItem(self.__hLine, ignoreBounds=True)    
        view.addItem(self.__textLastPrice, ignoreBounds=True)     
        self.proxy = pg.SignalProxy(view.scene().sigMouseMoved, rateLimit=60, slot=self.__mouseMoved)        
        
    #---------------------------------------------------------------------- 
开发者ID:zhengwsh,项目名称:InplusTrader_Linux,代码行数:25,代码来源:uiCrosshair.py

示例7: _init_line

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import InfiniteLine [as 别名]
def _init_line(self) -> None:
        """
        Create line objects.
        """
        self._v_lines: Dict[str, pg.InfiniteLine] = {}
        self._h_lines: Dict[str, pg.InfiniteLine] = {}
        self._views: Dict[str, pg.ViewBox] = {}

        pen = pg.mkPen(WHITE_COLOR)

        for plot_name, plot in self._plots.items():
            v_line = pg.InfiniteLine(angle=90, movable=False, pen=pen)
            h_line = pg.InfiniteLine(angle=0, movable=False, pen=pen)
            view = plot.getViewBox()

            for line in [v_line, h_line]:
                line.setZValue(0)
                line.hide()
                view.addItem(line)

            self._v_lines[plot_name] = v_line
            self._h_lines[plot_name] = h_line
            self._views[plot_name] = view 
开发者ID:nicai0609,项目名称:Python-CTPAPI,代码行数:25,代码来源:candle_demo.py

示例8: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import InfiniteLine [as 别名]
def __init__(self, ax, color):
        self.ax = ax
        self.x = 0
        self.y = 0
        self.clamp_x = 0
        self.clamp_y = 0
        self.infos = []
        pen = pg.mkPen(color=color, style=QtCore.Qt.CustomDashLine, dash=[7, 7])
        self.vline = pg.InfiniteLine(angle=90, movable=False, pen=pen)
        self.hline = pg.InfiniteLine(angle=0, movable=False, pen=pen)
        self.xtext = pg.TextItem(color=color, anchor=(0,1))
        self.ytext = pg.TextItem(color=color, anchor=(0,0))
        self.vline.setZValue(50)
        self.hline.setZValue(50)
        self.xtext.setZValue(50)
        self.ytext.setZValue(50)
        ax.addItem(self.vline, ignoreBounds=True)
        ax.addItem(self.hline, ignoreBounds=True)
        ax.addItem(self.xtext, ignoreBounds=True)
        ax.addItem(self.ytext, ignoreBounds=True) 
开发者ID:highfestiva,项目名称:finplot,代码行数:22,代码来源:__init__.py

示例9: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import InfiniteLine [as 别名]
def __init__(self, iface, plot):
        QObject.__init__(self)

        self.iface = iface
        self.plot = plot
        self.add_selection = False
        self.just_selected = False
        self.show_lines = True

        if has_pyqtgraph:
            self.plot.setClipToView(True)
            self.plot.enableAutoRange(enable=True)
            self.hist_selection = pg.PlotCurveItem()
            self.scatter_selection = []
            self.scatter = pg.ScatterPlotItem()
            self.scatter_points = {}
            self.region = pg.LinearRegionItem()
            #self.selected_points = []
            self.selected_points = pg.ScatterPlotItem()
            self.regress_line = pg.InfiniteLine()
            #self.roi = None

    #----
    # Histogram functions 
开发者ID:SpaceGroupUCL,项目名称:qgisSpaceSyntaxToolkit,代码行数:26,代码来源:AttributeCharts.py

示例10: initplotKline

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import InfiniteLine [as 别名]
def initplotKline(self):
        """初始化K线子图以及指标子图"""
        self.pwKL = self.makePI('_'.join([self.windowId,'PlotKL']))
        self.candle = CandlestickItem(self.listBar)
        self.pwKL.addItem(self.candle)
        
        
        self.KLINEOI_CLOSE = pg.PlotCurveItem(pen=({'color': "w", 'width': 1})) 
        self.pwKL.addItem(self.KLINEOI_CLOSE)
        self.KLINEOI_CLOSE.hide()
        
              
        self.MA_SHORTOI = pg.PlotCurveItem(pen=({'color': "r", 'width': 1})) 
        self.pwKL.addItem(self.MA_SHORTOI)
        self.MA_SHORTOI.hide()        
        
        
        self.MA_LONGOI = pg.PlotCurveItem(pen=({'color': "r", 'width': 1,'dash':[3, 3, 3, 3]})) 
        self.pwKL.addItem(self.MA_LONGOI)
        self.MA_LONGOI.hide()      
                
               
        self.start_date_Line     = pg.InfiniteLine(angle=90, movable=False,pen=({'color': [255, 255, 255, 100], 'width': 0.5})) 
        self.pwKL.addItem(self.start_date_Line)
        
        self.end_date_Line     = pg.InfiniteLine(angle=90,movable=False,pen=({'color': [255, 255, 0, 100], 'width': 0.5})) 
        self.pwKL.addItem(self.end_date_Line)        
        
        self.pwKL.setMinimumHeight(350)
        self.pwKL.setXLink('_'.join([self.windowId,'PlotOI']))
        self.pwKL.hideAxis('bottom')

        self.lay_KL.nextRow()
        self.lay_KL.addItem(self.pwKL)

    #---------------------------------------------------------------------- 
开发者ID:rjj510,项目名称:uiKLine,代码行数:38,代码来源:uiKLine.py

示例11: spaceline

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import InfiniteLine [as 别名]
def spaceline(self):
        if self._spaceline is None:
            self._spaceline = pg.InfiniteLine()
            self._spaceline.setPen(self.clock.pen)
        return self._spaceline 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:7,代码来源:relativity.py

示例12: reset

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import InfiniteLine [as 别名]
def reset(self):
        self.i = 1
        

#class Spaceline(pg.InfiniteLine):
    #def __init__(self, sim, frame):
        #self.sim = sim
        #self.frame = frame
        #pg.InfiniteLine.__init__(self)
        #self.setPen(sim.clocks[frame].pen)
        
    #def stepTo(self, t):
        #self.setAngle(0)
        
        #pass 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:17,代码来源:relativity.py

示例13: test_getViewWidget

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import InfiniteLine [as 别名]
def test_getViewWidget():
    view = pg.PlotWidget()
    vref = weakref.ref(view)
    item = pg.InfiniteLine()
    view.addItem(item)
    assert item.getViewWidget() is view
    del view
    gc.collect()
    assert vref() is None
    assert item.getViewWidget() is None 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:12,代码来源:test_GraphicsItem.py

示例14: test_InfiniteLine

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import InfiniteLine [as 别名]
def test_InfiniteLine():
    # Test basic InfiniteLine API
    plt = pg.plot()
    plt.setXRange(-10, 10)
    plt.setYRange(-10, 10)
    plt.resize(600, 600)
    
    # seemingly arbitrary requirements; might need longer wait time for some platforms..
    QtTest.QTest.qWaitForWindowShown(plt)
    QtTest.QTest.qWait(100)
    
    vline = plt.addLine(x=1)
    assert vline.angle == 90
    br = vline.mapToView(QtGui.QPolygonF(vline.boundingRect()))
    assert br.containsPoint(pg.Point(1, 5), QtCore.Qt.OddEvenFill)
    assert not br.containsPoint(pg.Point(5, 0), QtCore.Qt.OddEvenFill)
    hline = plt.addLine(y=0)
    assert hline.angle == 0
    assert hline.boundingRect().contains(pg.Point(5, 0))
    assert not hline.boundingRect().contains(pg.Point(0, 5))

    vline.setValue(2)
    assert vline.value() == 2
    vline.setPos(pg.Point(4, -5))
    assert vline.value() == 4
    
    oline = pg.InfiniteLine(angle=30)
    plt.addItem(oline)
    oline.setPos(pg.Point(1, -1))
    assert oline.angle == 30
    assert oline.pos() == pg.Point(1, -1)
    assert oline.value() == [1, -1]
    
    # test bounding rect for oblique line
    br = oline.mapToScene(oline.boundingRect())
    pos = oline.mapToScene(pg.Point(2, 0))
    assert br.containsPoint(pos, QtCore.Qt.OddEvenFill)
    px = pg.Point(-0.5, -1.0 / 3**0.5)
    assert br.containsPoint(pos + 5 * px, QtCore.Qt.OddEvenFill)
    assert not br.containsPoint(pos + 7 * px, QtCore.Qt.OddEvenFill) 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:42,代码来源:test_InfiniteLine.py

示例15: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import InfiniteLine [as 别名]
def __init__(self, *args, **kwargs):
            pg.InfiniteLine.__init__(self, *args, **kwargs)
            self.setCursor(QtCore.Qt.SizeVerCursor) 
开发者ID:pyrocko,项目名称:kite,代码行数:5,代码来源:tab_covariance.py


注:本文中的pyqtgraph.InfiniteLine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。