本文整理汇总了Python中pyqtgraph.setConfigOption方法的典型用法代码示例。如果您正苦于以下问题:Python pyqtgraph.setConfigOption方法的具体用法?Python pyqtgraph.setConfigOption怎么用?Python pyqtgraph.setConfigOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqtgraph
的用法示例。
在下文中一共展示了pyqtgraph.setConfigOption方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generatePicture
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import setConfigOption [as 别名]
def generatePicture(self):
## pre-computing a QPicture object allows paint() to run much more quickly,
## rather than re-drawing the shapes every time.
self.picture = QtGui.QPicture()
p = QtGui.QPainter(self.picture)
p.setPen(pg.mkPen(color='w', width=0.4)) # 0.4 means w*2
a = pg.AxisItem('bottom', pen=None, linkView=None, parent=None, maxTickLength=-5, showValues=True)
a.setFixedWidth(1)
a.setWidth(1)
a.setLabel(show=True)
a.setGrid(grid=True)
labelStyle = {'color': '#FFF', 'font-size': '14pt'}
a.setLabel('label text', units='V', **labelStyle)
# w = (self.data[1][0] - self.data[0][0]) / 3.
w = 0.2
for (t, open, close, min, max) in self.data:
p.drawLine(QtCore.QPointF(t, min), QtCore.QPointF(t, max))
if open > close:
p.setBrush(pg.mkBrush('g'))
else:
p.setBrush(pg.mkBrush('r'))
p.drawRect(QtCore.QRectF(t-w, open, w*2, close-open))
pg.setConfigOption('leftButtonPan', False)
p.end()
示例2: test_plotscene
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import setConfigOption [as 别名]
def test_plotscene():
tempfilename = tempfile.NamedTemporaryFile(suffix='.svg').name
print("using %s as a temporary file" % tempfilename)
pg.setConfigOption('foreground', (0,0,0))
w = pg.GraphicsWindow()
w.show()
p1 = w.addPlot()
p2 = w.addPlot()
p1.plot([1,3,2,3,1,6,9,8,4,2,3,5,3], pen={'color':'k'})
p1.setXRange(0,5)
p2.plot([1,5,2,3,4,6,1,2,4,2,3,5,3], pen={'color':'k', 'cosmetic':False, 'width': 0.3})
app.processEvents()
app.processEvents()
ex = pg.exporters.SVGExporter(w.scene())
ex.export(fileName=tempfilename)
# clean up after the test is done
os.unlink(tempfilename)
示例3: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import setConfigOption [as 别名]
def __init__(self, parent=None):
pyqtgraph.setConfigOption('background', 'w') #before loading widget
super(ExampleApp, self).__init__(parent)
self.setupUi(self)
self.grECG.plotItem.showGrid(True, True, 0.7)
self.btnSave.clicked.connect(self.saveFig)
self.btnSite.clicked.connect(self.website)
stamp="DIY ECG by Scott Harden"
self.stamp = pyqtgraph.TextItem(stamp,anchor=(-.01,1),color=(150,150,150),
fill=pyqtgraph.mkBrush('w'))
self.ear = swhear.Ear(chunk=int(100)) # determines refresh rate
# optionally you can manually set the audio input device to use like this:
# self.ear = swhear.Ear(chunk=int(100), device=5) # use audio input device 5
if len(self.ear.valid_input_devices()):
self.ear.stream_start()
self.lblDevice.setText(self.ear.msg)
self.update()
示例4: clicked
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import setConfigOption [as 别名]
def clicked(self):
l = float(self.edit1.text())
r = float(self.edit2.text())
s = float(self.edit3.text())
x = np.arange(l,r,s)
print(x)
s = calculator_class.var
print("In Second")
print(s)
y = eval(s)
pg.setConfigOption('background', 'w') # sets background white
pg.setConfigOption('foreground', 'k') # sets axis color to black
pw = pg.plot(x,y,pen = 'k')
pw.setTitle('y = f(x)')
pw.setLabel('bottom', 'x -->') # x-label
pw.setLabel('left', 'y = f(x) -->') # y-label
示例5: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import setConfigOption [as 别名]
def __init__(self, parent=None):
pyqtgraph.setConfigOption('background', 'w') #before loading widget
super(ExampleApp, self).__init__(parent)
self.setupUi(self)
self.grFFT.plotItem.showGrid(True, True, 0.7)
self.grPCM.plotItem.showGrid(True, True, 0.7)
self.maxFFT=0
self.maxPCM=0
self.ear = SWHear.SWHear(rate=44100,updatesPerSecond=20)
self.ear.stream_start()
示例6: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import setConfigOption [as 别名]
def __init__(self, parent=None):
pyqtgraph.setConfigOption('background', 'w') #before loading widget
super(ExampleApp, self).__init__(parent)
self.setupUi(self)
self.btnAdd.clicked.connect(self.update)
self.grPlot.plotItem.showGrid(True, True, 0.7)
示例7: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import setConfigOption [as 别名]
def __init__(self):
pg.setConfigOptions(antialias=True)
self.twiss_plot = pg.GraphicsLayoutWidget()
# Switch to using white background and black foreground
#pg.setConfigOption('background', 'w')
#pg.setConfigOption('foreground', 'k')
self.plot_disp_x = self.twiss_plot.addPlot(row=0, col=0)
self.plot_disp_x.showGrid(x=True, y=True)
self.plot_beta = self.twiss_plot.addPlot(row=1, col=0)
self.plot_beta.showGrid(x=True, y=True)
self.plot_lattice = self.twiss_plot.addPlot(row=3, col=0)
self.plot_lattice.showGrid(x=False, y=False)
#self.plot_lattice.hideAxis('left')
self.plot_lattice.setMenuEnabled(enableMenu=False)
self.plot_disp_x.setXLink(self.plot_lattice)
self.plot_disp_x.addLegend()
self.plot_beta.setXLink(self.plot_lattice)
self.plot_beta.addLegend()
color_blue = QtGui.QColor(0, 0, 255)
color_red = QtGui.QColor(255, 0, 0)
color_aqua = QtGui.QColor(0, 255, 255)
pen_blue = pg.mkPen(color_blue, width=2)
pen_red = pg.mkPen(color_red, width=2)
pen_aqua = pg.mkPen(color_aqua, width=2)
self.curv1 = self.plot_disp_x.plot(pen=pen_aqua, name='Dx')
self.curv2 = self.plot_beta.plot(pen=pen_aqua, name='betaX')
self.curv3 = self.plot_beta.plot(pen=pen_red, name='betaY')
示例8: set_plot_background
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import setConfigOption [as 别名]
def set_plot_background(self, option):
self._settings.setValue("plot_background", option)
if option == "Black":
pg.setConfigOption("background", "k")
pg.setConfigOption("foreground", "w")
else:
pg.setConfigOption("background", "w")
pg.setConfigOption("foreground", "k")
示例9: initializeGraphWidgets
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import setConfigOption [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()