本文整理汇总了Python中pyqtgraph.GraphicsLayout方法的典型用法代码示例。如果您正苦于以下问题:Python pyqtgraph.GraphicsLayout方法的具体用法?Python pyqtgraph.GraphicsLayout怎么用?Python pyqtgraph.GraphicsLayout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqtgraph
的用法示例。
在下文中一共展示了pyqtgraph.GraphicsLayout方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init_window
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsLayout [as 别名]
def init_window(x=0, y=0, w=1440, h=1080, title='Hello World'):
global _window_view, _window_layout, _window_imgs, _window_stats_label, _windows
view = pg.GraphicsView()
layout = pg.GraphicsLayout(border=(100,100,100))
view.setCentralItem(layout)
view.setWindowTitle(title)
view.setGeometry(x, y, w, h)
view.show()
imgs = []
imgs.append( _add_image_to_layout(layout, title='capture') )
imgs.append( _add_image_to_layout(layout, title='processed') )
imgs.append( _add_image_to_layout(layout, title='prediction') )
layout.nextRow()
stats_label = pg.LabelItem()
layout.addItem(stats_label, colspan=3)
_window_view = view
_window_layout = layout
_window_imgs = imgs
_window_stats_label = stats_label
_windows.append(view)
示例2: initUI
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsLayout [as 别名]
def initUI(self):
self.pw = pg.PlotWidget()
self.layout = pg.GraphicsLayout(border=(100, 100, 100))
self.layout.setContentsMargins(0, 0, 0, 0)
self.layout.setSpacing(0)
self.layout.setBorder(color=(255, 255, 255, 255), width=0.8)
self.layout.setZValue(0)
self.layout.setMinimumHeight(140)
self.pw.setCentralWidget(self.layout)
# 设置横坐标
xdict = {}
self.axisTime = MyStringAxis(xdict, orientation='bottom')
# 初始化资金曲线
self.initPlotFund()
# 十字光标
self.crosshair = Crosshair(self.pw, self)
self.vbox = QtWidgets.QVBoxLayout()
self.vbox.addWidget(self.pw)
self.setLayout(self.vbox)
self.initCompleted = True
self.oldSize = self.rect().height()
示例3: initUI
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsLayout [as 别名]
def initUI(self):
self.pw = pg.PlotWidget()
self.layout = pg.GraphicsLayout(border=(10, 10, 10))
self.layout.setContentsMargins(0, 0, 0, 0)
self.layout.setSpacing(0)
self.layout.setBorder(color=(255, 255, 255, 255), width=0.8)
self.layout.setZValue(0)
self.layout.setMinimumHeight(140)
self.pw.setCentralWidget(self.layout)
# 设置横坐标
xdict = {}
self.axisTime = MyStringAxis(xdict, orientation='bottom')
# 初始化资金曲线
self.initPlotGraph()
# 十字光标
self.crosshair = GCrosshair(self.pw, self)
self.vbox = QVBoxLayout()
self.vbox.addWidget(self.pw)
self.setLayout(self.vbox)
self.initCompleted = True
self.oldSize = self.rect().height()
示例4: initUi
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsLayout [as 别名]
def initUi(self):
"""初始化界面"""
self.setWindowTitle(u'K线工具')
# 主图
self.pw = pg.PlotWidget()
# 界面布局
self.lay_KL = pg.GraphicsLayout(border=(100,100,100))
self.lay_KL.setContentsMargins(10, 10, 10, 10)
self.lay_KL.setSpacing(0)
self.lay_KL.setBorder(color=(255, 0, 0, 255), width=0.8)
self.lay_KL.setZValue(0)
self.KLtitle = self.lay_KL.addLabel(u'')
self.pw.setCentralItem(self.lay_KL)
# 设置横坐标
xdict = {}
self.axisTime = MyStringAxis(xdict, orientation='bottom')
# 初始化子图
self.initplotKline()
self.initplotVol()
self.initplotOI()
# 注册十字光标
self.crosshair = Crosshair(self.pw,self)
# 设置界面
self.vb = QVBoxLayout()
self.vb.addWidget(self.pw)
self.setLayout(self.vb)
# 初始化完成
self.initCompleted = True
#----------------------------------------------------------------------
示例5: initUi
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsLayout [as 别名]
def initUi(self):
"""初始化界面"""
self.setWindowTitle(u'K线工具')
# 主图
self.pw = pg.PlotWidget()
# 界面布局
self.lay_KL = pg.GraphicsLayout(border=(100,100,100))
self.lay_KL.setContentsMargins(10, 10, 10, 10)
self.lay_KL.setSpacing(0)
self.lay_KL.setBorder(color=(255, 255, 255, 255), width=0.8)
self.lay_KL.setZValue(0)
self.KLtitle = self.lay_KL.addLabel(u'')
self.pw.setCentralItem(self.lay_KL)
# 设置横坐标
xdict = {}
self.axisTime = MyStringAxis(xdict, orientation='bottom')
# 初始化子图
self.initplotKline()
self.initplotVol()
self.initplotOI()
# 注册十字光标
self.crosshair = Crosshair(self.pw,self)
# 设置界面
self.vb = QVBoxLayout()
self.vb.addWidget(self.pw)
self.setLayout(self.vb)
# 初始化完成
self.initCompleted = True
#----------------------------------------------------------------------
示例6: _init_ui
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsLayout [as 别名]
def _init_ui(self) -> None:
""""""
self.setWindowTitle("程序化交易入门(QuantRoad2019)")
self._layout = pg.GraphicsLayout()
self._layout.setContentsMargins(10, 10, 10, 10)
self._layout.setSpacing(0)
self._layout.setBorder(color=GREY_COLOR, width=0.8)
self._layout.setZValue(0)
self.setCentralItem(self._layout)
self._x_axis = DatetimeAxis(self._manager, orientation='bottom')
示例7: initUi
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsLayout [as 别名]
def initUi(self):
"""
初始化界面
leyout 如下:
------------------————————
\ 主图(K线/主图指标/交易信号 \
\ \
-----------------------------------
\ 副图1(成交量) \
-----------------------------------
\ 副图2(持仓量/副图指标) \
-----------------------------------
:return:
"""
self.setWindowTitle(u'K线工具')
# 主图
self.pw = pg.PlotWidget()
# 界面布局
self.lay_KL = pg.GraphicsLayout(border=(100,100,100))
#self.lay_KL.setContentsMargins(10, 10, 10, 10)
self.lay_KL.setContentsMargins(5, 5, 5, 5)
self.lay_KL.setSpacing(0)
self.lay_KL.setBorder(color=(100, 100, 100, 250), width=0.4)
self.lay_KL.setZValue(0)
self.KLtitle = self.lay_KL.addLabel(u'')
self.pw.setCentralItem(self.lay_KL)
# 设置横坐标
xdict = {}
self.axisTime = MyStringAxis(xdict, orientation='bottom')
# 初始化子图
self.init_plot_main()
self.init_plot_volume()
self.init_plot_sub()
# 注册十字光标
self.crosshair = Crosshair(self.pw, self)
# 设置界面
self.vb = QtWidgets.QVBoxLayout()
self.vb.addWidget(self.pw)
self.setLayout(self.vb)
# 初始化完成
self.initCompleted = True
# ----------------------------------------------------------------------
示例8: initializeGraphWidgets
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsLayout [as 别名]
def initializeGraphWidgets(self):
pg.setConfigOption('foreground', 'w')
pg.setConfigOption('background', (32, 48, 68))
pg.GraphicsLayout(border=(100,100,100))
self.strPlot1Title = str(self.theSettings.SETT_GetSettings()["strTradingPair"]) + ' Coinbase Pro Market Price (' + str(self.theSettings.SETT_GetSettings()["strFiatType"]) + ')'
self.plot1 = pg.PlotWidget(title=self.strPlot1Title, axisItems={'bottom': TimeAxisItem(orientation='bottom')})
self.plot1.setYRange(self.minInPlot1, self.maxInPlot1)
self.plot1.setMouseEnabled(False, False) # Mettre False, True pour release
self.plot1.setMenuEnabled(False)
axis = self.plot1.getAxis('bottom') # This is the trick
axis.setStyle(textFillLimits = [(0, 0.7)])
#self.plot1.plotItem.vb.setBackgroundColor((15, 25, 34, 255))
self.plot2 = pg.PlotWidget(title='Astibot decision indicator (normalized)')
self.plot2.showGrid(x=True,y=True,alpha=0.1)
self.plot2.setYRange(-100, 100)
self.plot2.setMouseEnabled(False, True)
self.plot2.setMouseEnabled(False)
self.plot2.hideAxis('bottom')
# Graphs take one row but 2 columns
self.mainGridLayout.addWidget(self.plot1, 9, 1, 1, 2)
self.mainGridLayout.addWidget(self.plot2, 10, 1, 1, 2)
# Graph curves initialization
self.plot1GraphLivePrice = self.plot1.plot(x=self.graphDataTime, y=self.graphDataBitcoinPrice, name=' Price') # , clipToView=True
self.plot1GraphLivePrice.setPen(color=(220,220,220), width=3)
self.plot1GraphSmoothPriceFast = self.plot1.plot(x=self.graphDataTime, y=self.graphDataBitcoinPriceSmoothFast, name=' Price Fast MA')
self.plot1GraphSmoothPriceFast.setPen(color=(3,86,243), width=2)
self.plot1GraphSmoothPriceSlow = self.plot1.plot(x=self.graphDataTime, y=self.graphDataBitcoinPriceSmoothSlow, name=' Price Slow MA')
self.plot1GraphSmoothPriceSlow.setPen(color=(230,79,6), width=2)
self.plot1GraphRiskLine = self.plot1.plot(x=self.graphDataTime, y=self.graphDataBitcoinRiskLine, name=' Risk Line')
self.plot1GraphRiskLine.setPen(color=(255,46,46), width=2, style=QtCore.Qt.DotLine)
self.plot1Markers1 = self.plot1.plot(x=self.graphDataTime, y=self.graphDataBitcoinPriceMarker1, name=' Buy', pen=None, symbol='o', symbolPen=(43, 206, 55), symbolBrush=(43, 206, 55), symbolSize = 30)
self.plot1Markers2 = self.plot1.plot(x=self.graphDataTime, y=self.graphDataBitcoinPriceMarker2, name=' Sell', pen=None, symbol='o', symbolPen=(255, 0, 0), symbolBrush=(255, 0, 0), symbolSize = 30)
# Graph 2 (Indicators) curves initialization
self.plot2GraphIndicatorMACD = self.plot2.plot(x=self.graphDataTime, y=self.graphDataIndicatorMACD, pen='y', name=' MACD')
self.graphicObject = pg.GraphicsObject()