當前位置: 首頁>>代碼示例>>Python>>正文


Python pyqtgraph.PlotItem方法代碼示例

本文整理匯總了Python中pyqtgraph.PlotItem方法的典型用法代碼示例。如果您正苦於以下問題:Python pyqtgraph.PlotItem方法的具體用法?Python pyqtgraph.PlotItem怎麽用?Python pyqtgraph.PlotItem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pyqtgraph的用法示例。


在下文中一共展示了pyqtgraph.PlotItem方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: makePI

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import PlotItem [as 別名]
def makePI(self,name):
        """生成PlotItem對象"""
        vb = CustomViewBox()
        plotItem = pg.PlotItem(viewBox = vb, name=name ,axisItems={'bottom': self.axisTime})
        plotItem.setMenuEnabled(False)
        plotItem.setClipToView(True)
        plotItem.hideAxis('left')
        plotItem.showAxis('right')
        plotItem.setDownsampling(mode='peak')
        plotItem.setRange(xRange = (0,1),yRange = (0,1))
        plotItem.getAxis('right').setWidth(30)
        plotItem.getAxis('right').setStyle(tickFont = QFont("Roman times",10,QFont.Bold))
        plotItem.getAxis('right').setPen(color=(255, 0, 0, 255), width=0.8)
        plotItem.showGrid(True,True)
        plotItem.hideButtons()
        return plotItem

    #---------------------------------------------------------------------- 
開發者ID:rjj510,項目名稱:uiKLine,代碼行數:20,代碼來源:uiKLine.py

示例2: test_getViewWidget_deleted

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import PlotItem [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: create_plot_item

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import PlotItem [as 別名]
def create_plot_item(self, name):
        """生成PlotItem對象"""
        vb = CustomViewBox()
        plotItem = pg.PlotItem(viewBox = vb, name=name ,axisItems={'bottom': self.axisTime})
        plotItem.setMenuEnabled(False)
        plotItem.setClipToView(True)
        plotItem.hideAxis('left')
        plotItem.showAxis('right')
        plotItem.setDownsampling(mode='peak')
        plotItem.setRange(xRange = (0,1),yRange = (0,1))
        plotItem.getAxis('right').setWidth(60)
        plotItem.getAxis('right').setStyle(tickFont = QtGui.QFont("Roman times",10,QtGui.QFont.Bold))
        plotItem.getAxis('right').setPen(color=(255, 255, 255, 255), width=0.8)
        plotItem.showGrid(True, True)
        plotItem.hideButtons()
        return plotItem

    # ---------------------------------------------------------------------- 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:20,代碼來源:uiKLine.py

示例4: init_plot_main

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import PlotItem [as 別名]
def init_plot_main(self):
        """
        初始化主圖
        1、添加 K線(蠟燭圖)
        :return:
        """
        # 創建K線PlotItem
        self.pi_main = self.create_plot_item('_'.join([self.windowId, 'Plot_Main']))

        # 創建蠟燭圖
        self.ci_candle = CandlestickItem(self.listBar)

        # 添加蠟燭圖到主圖
        self.pi_main.addItem(self.ci_candle)
        self.pi_main.setMinimumHeight(200)
        self.pi_main.setXLink('_'.join([self.windowId, 'Plot_Sub']))
        self.pi_main.hideAxis('bottom')

        # 添加主圖到window layout
        self.lay_KL.nextRow()
        self.lay_KL.addItem(self.pi_main)

    # ---------------------------------------------------------------------- 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:25,代碼來源:uiKLine.py

示例5: initialize_plot

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import PlotItem [as 別名]
def initialize_plot(self):
        
        self.viewBox = MyViewBox()
        self.viewBox.doubleclicked.connect(self.open_settings)
        self.viewBox.gain_zoom.connect(self.gain_zoom)
        self.viewBox.disableAutoRange()
        
        self.plot = pg.PlotItem(viewBox=self.viewBox)
        self.graphicsview.setCentralItem(self.plot)
        self.plot.hideButtons()
        
        self.image = pg.ImageItem()
        self.plot.addItem(self.image)
        
        self.curve_spike = pg.PlotCurveItem()
        self.plot.addItem(self.curve_spike)

        self.curve_limit = pg.PlotCurveItem()
        self.plot.addItem(self.curve_limit)
        
        self.change_lut() 
開發者ID:tridesclous,項目名稱:tridesclous,代碼行數:23,代碼來源:onlinewaveformhistviewer.py

示例6: makePI

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import PlotItem [as 別名]
def makePI(self,name):
        """生成PlotItem對象"""
        vb = CustomViewBox()
        plotItem = pg.PlotItem(viewBox = vb, name=name ,axisItems={'bottom': self.axisTime})
        plotItem.setMenuEnabled(False)
        plotItem.setClipToView(True)
        plotItem.hideAxis('left')
        plotItem.showAxis('right')
        plotItem.setDownsampling(mode='peak')
        plotItem.setRange(xRange = (0,1),yRange = (0,1))
        plotItem.getAxis('right').setWidth(60)
        plotItem.getAxis('right').setStyle(tickFont = QFont("Roman times",10,QFont.Bold))
        plotItem.getAxis('right').setPen(color=(255, 255, 255, 255), width=0.8)
        plotItem.showGrid(True,True)
        plotItem.hideButtons()
        return plotItem

    #---------------------------------------------------------------------- 
開發者ID:moonnejs,項目名稱:uiKLine,代碼行數:20,代碼來源:uiKLine.py

示例7: initPlot

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import PlotItem [as 別名]
def initPlot(self):
        '''
        Inits the plot canvas pyqtgraph.plotItem
        '''
        if not self.visible:
            return
        self.plotItem = pg.PlotItem(name='%s.%s' %
                                    (self.stats.network, self.stats.station),
                                    clipToView=True, autoDownsample=True)
        self.plotItem.hideButtons()

        self.plotItem.setMouseEnabled(x=True, y=False)
        self.plotItem.getAxis('left').setWidth(35)
        self.plotItem.getAxis('bottom').setGrid(150)
        self.plotItem.enableAutoRange('y', 1.)

        self.plotItem.getAxis('bottom').setStyle(showValues=False)

        self.plotSelectedChannel()
        self.parent.GraphicsLayout.addItem(self.plotItem,
                                           row=self.parent.stations.index(self))

        self.parent.GraphicsLayout.nextRow()
        self.parent.updateAllPlots() 
開發者ID:miili,項目名稱:wavePicker,代碼行數:26,代碼來源:guiContainer.py

示例8: __init__

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import PlotItem [as 別名]
def __init__(self, parent: QtWidgets.QWidget = None):
        """"""
        super().__init__(parent)

        self._manager: BarManager = BarManager()

        self._plots: Dict[str, pg.PlotItem] = {}
        self._items: Dict[str, ChartItem] = {}
        self._item_plot_map: Dict[ChartItem, pg.PlotItem] = {}

        self._first_plot: pg.PlotItem = None
        self._cursor: ChartCursor = None

        self._right_ix: int = 0                     # Index of most right data
        self._bar_count: int = self.MIN_BAR_COUNT   # Total bar visible in chart

        self._init_ui() 
開發者ID:nicai0609,項目名稱:Python-CTPAPI,代碼行數:19,代碼來源:candle_demo.py

示例9: makePI

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import PlotItem [as 別名]
def makePI(self, name):
        """生成PlotItem對象"""
        vb = CustomViewBox(self)
        plotItem = pg.PlotItem(viewBox=vb, name=name, axisItems={'bottom': self.axisTime})
        plotItem.setMenuEnabled(False)
        # 僅繪製ViewBox可見範圍內的點
        plotItem.setClipToView(True)
        plotItem.hideAxis('left')
        plotItem.showAxis('right')
        # 設置采樣模式
        plotItem.setDownsampling(mode='peak')
        plotItem.setRange(xRange=(0, 1), yRange=(0, 1))
        plotItem.getAxis('right').setWidth(70)
        plotItem.getAxis('right').setStyle(tickFont=QtGui.QFont('Roman times', 10, QtGui.QFont.Bold))
        plotItem.getAxis('right').setPen(color=(255, 255, 255, 255), width=0.8)
        plotItem.showGrid(True, True)
        plotItem.hideButtons()

        return plotItem 
開發者ID:epolestar,項目名稱:equant,代碼行數:21,代碼來源:fundtab.py

示例10: makePI

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import PlotItem [as 別名]
def makePI(self, name):
        """生成PlotItem對象"""
        vb = CustomViewBox(self)
        plotItem = pg.PlotItem(viewBox=vb, name=name, axisItems={'bottom': self.axisTime})
        plotItem.setMenuEnabled(False)
        # 僅繪製ViewBox可見範圍內的點
        plotItem.setClipToView(True)
        plotItem.showAxis('left')
        # 設置采樣模式
        plotItem.setDownsampling(mode='peak')
        plotItem.setRange(xRange=(0, 1), yRange=(0, 1))
        plotItem.getAxis('left').setWidth(70)
        plotItem.getAxis('left').setStyle(tickFont=QtGui.QFont('Roman times', 10, QtGui.QFont.Bold))
        plotItem.getAxis('left').setPen(color=(255, 255, 255, 255), width=0.8)
        plotItem.showGrid(True, True)
        plotItem.hideButtons()

        return plotItem 
開發者ID:epolestar,項目名稱:equant,代碼行數:20,代碼來源:graphtab.py

示例11: _add_timestamp_plot

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import PlotItem [as 別名]
def _add_timestamp_plot(win, prev_ax, viewbox, index, yscale):
    if prev_ax is not None:
        prev_ax.hideAxis('bottom') # hide the whole previous axis
        win.nextRow()
    axes = {'bottom': EpochAxisItem(vb=viewbox, orientation='bottom'),
            'left':   YAxisItem(vb=viewbox, orientation='left')}
    ax = pg.PlotItem(viewBox=viewbox, axisItems=axes, name='plot-%i'%index)
    ax.axes['left']['item'].textWidth = y_label_width # this is to put all graphs on equal footing when texts vary from 0.4 to 2000000
    ax.axes['left']['item'].setStyle(tickLength=-5) # some bug, totally unexplicable (why setting the default value again would fix repaint width as axis scale down)
    ax.axes['left']['item'].setZValue(30) # put axis in front instead of behind data
    ax.axes['bottom']['item'].setZValue(30)
    ax.setLogMode(y=(yscale.scaletype=='log'))
    ax.significant_decimals = significant_decimals
    ax.significant_eps = significant_eps
    ax.crosshair = FinCrossHair(ax, color=cross_hair_color)
    ax.hideButtons()
    ax.overlay = partial(_overlay, ax)
    if index%2:
        viewbox.setBackgroundColor(odd_plot_background)
    viewbox.setParent(ax)
    win.addItem(ax)
    return ax 
開發者ID:highfestiva,項目名稱:finplot,代碼行數:24,代碼來源:__init__.py

示例12: _overlay

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import PlotItem [as 別名]
def _overlay(ax, scale=0.25):
    global overlay_axs
    viewbox = FinViewBox(ax.vb.win, init_steps=ax.vb.init_steps, yscale=YScale('linear', 1))
    viewbox.v_zoom_scale = scale
    ax.vb.win.centralWidget.scene().addItem(viewbox)
    viewbox.setXLink(ax.vb)
    def updateView():
        viewbox.setGeometry(ax.vb.sceneBoundingRect())
    axo = pg.PlotItem()
    axo.significant_decimals = significant_decimals
    axo.significant_eps = significant_eps
    axo.vb = viewbox
    axo.hideAxis('left')
    axo.hideAxis('bottom')
    axo.hideButtons()
    viewbox.addItem(axo)
    ax.vb.sigResized.connect(updateView)
    overlay_axs.append(axo)
    return axo 
開發者ID:highfestiva,項目名稱:finplot,代碼行數:21,代碼來源:__init__.py

示例13: initialize_plot

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import PlotItem [as 別名]
def initialize_plot(self):
        self.viewBox = MyViewBox()
        self.viewBox.doubleclicked.connect(self.open_settings)
        #~ self.viewBox.gain_zoom.connect(self.gain_zoom)
        self.viewBox.disableAutoRange()
        
        self.plot = pg.PlotItem(viewBox=self.viewBox)
        self.graphicsview.setCentralItem(self.plot)
        self.plot.hideButtons() 
開發者ID:tridesclous,項目名稱:tridesclous,代碼行數:11,代碼來源:featuretimeviewer.py

示例14: __init__

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import PlotItem [as 別名]
def __init__(self, parent = None, channel_groups=None):
        QT.QWidget.__init__(self, parent)
        
        self.channel_groups = channel_groups
        
        self.layout = QT.QVBoxLayout()
        self.setLayout(self.layout)
        
        h = QT.QHBoxLayout()
        self.layout.addLayout(h)
        
        self.combo_chan_grp = QT.QComboBox()
        h.addWidget(self.combo_chan_grp)
        self.combo_chan_grp.clear()
        self.combo_chan_grp.addItems([str(k) for k in self.channel_groups.keys()])
        self.combo_chan_grp.currentIndexChanged .connect(self.on_chan_grp_change)
        
        self.checkbox = QT.QCheckBox('flip_bottom_up')
        h.addWidget(self.checkbox)
        self.checkbox.stateChanged.connect(self.refresh)
        
        #~ self.combo_chan_grp.blockSignals(True)
        #~ self.combo_chan_grp.blockSignals(False)
        #~ self.on_chan_grp_change()

        
        self.graphicsview = pg.GraphicsView()
        self.layout.addWidget(self.graphicsview)
        

        self.viewBox = MyViewBox()
        self.viewBox.disableAutoRange()
        
        self.plot = pg.PlotItem(viewBox=self.viewBox)
        self.graphicsview.setCentralItem(self.plot)
        self.plot.hideButtons()
        self.plot.showAxis('left', False)
        
        self.refresh() 
開發者ID:tridesclous,項目名稱:tridesclous,代碼行數:41,代碼來源:probegeometryview.py

示例15: initialize_plot

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import PlotItem [as 別名]
def initialize_plot(self):
        self.viewBox = MyViewBox()
        self.viewBox.doubleclicked.connect(self.open_settings)
        #~ self.viewBox.disableAutoRange()
        
        self.plot = pg.PlotItem(viewBox=self.viewBox)
        self.graphicsview.setCentralItem(self.plot)
        self.plot.hideButtons()
        
        #ISI are computed on demand
        self.all_isi = {} 
開發者ID:tridesclous,項目名稱:tridesclous,代碼行數:13,代碼來源:isiviewer.py


注:本文中的pyqtgraph.PlotItem方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。