本文整理汇总了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
#----------------------------------------------------------------------
示例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()
示例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
# ----------------------------------------------------------------------
示例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)
# ----------------------------------------------------------------------
示例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()
示例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
#----------------------------------------------------------------------
示例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()
示例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()
示例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
示例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
示例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
示例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
示例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()
示例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()
示例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 = {}