本文整理汇总了Python中pyqtgraph.setConfigOptions方法的典型用法代码示例。如果您正苦于以下问题:Python pyqtgraph.setConfigOptions方法的具体用法?Python pyqtgraph.setConfigOptions怎么用?Python pyqtgraph.setConfigOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqtgraph
的用法示例。
在下文中一共展示了pyqtgraph.setConfigOptions方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: plot_team
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import setConfigOptions [as 别名]
def plot_team(self):
# these would contain list of x coordinates
self.Monitors_rounds = []
self.WIPs_rounds = []
self.MPs_rounds = []
# these would contain list of yc coordinates
self.Monitors_qty = []
self.WIPs_qty = []
self.MPs_qty = []
self.win = pg.GraphicsLayoutWidget()
self.win.setWindowTitle("Number of Peers in the Team")
self.win.resize(800, 600)
# Enable antialiasing for prettier plots
# pg.setConfigOptions(antialias=True)
self.p3 = self.win.addPlot() # Adding plot to window like matplotlib subplot method
self.p3.addLegend()
# Create separate plots to handle regular,monitor and malicious peer it is much like matplotlib plot method
self.lineWIPs = self.p3.plot(pen=(None), symbolBrush=(0, 0, 255), symbolPen='b', name='#WIP')
self.lineMonitors = self.p3.plot(pen=(None), symbolBrush=(0, 255, 0), symbolPen='g', name='#Monitors Peers')
self.lineMPs = self.p3.plot(pen=(None), symbolBrush=(255, 0, 0), symbolPen='r', name='Malicious Peers')
total_peers = self.number_of_monitors + self.number_of_peers + self.number_of_malicious
self.p3.setRange(xRange=[0, self.number_of_rounds], yRange=[0, total_peers])
self.win.show()
示例2: test_getArrayRegion
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import setConfigOptions [as 别名]
def test_getArrayRegion(transpose=False):
pr = pg.PolyLineROI([[0, 0], [27, 0], [0, 28]], closed=True)
pr.setPos(1, 1)
rois = [
(pg.ROI([1, 1], [27, 28], pen='y'), 'baseroi'),
(pg.RectROI([1, 1], [27, 28], pen='y'), 'rectroi'),
(pg.EllipseROI([1, 1], [27, 28], pen='y'), 'ellipseroi'),
(pr, 'polylineroi'),
]
for roi, name in rois:
# For some ROIs, resize should not be used.
testResize = not isinstance(roi, pg.PolyLineROI)
origMode = pg.getConfigOption('imageAxisOrder')
try:
if transpose:
pg.setConfigOptions(imageAxisOrder='row-major')
check_getArrayRegion(roi, 'roi/'+name, testResize, transpose=True)
else:
pg.setConfigOptions(imageAxisOrder='col-major')
check_getArrayRegion(roi, 'roi/'+name, testResize)
finally:
pg.setConfigOptions(imageAxisOrder=origMode)
示例3: test_ImageItem_axisorder
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import setConfigOptions [as 别名]
def test_ImageItem_axisorder():
# All image tests pass again using the opposite axis order
origMode = pg.getConfigOption('imageAxisOrder')
altMode = 'row-major' if origMode == 'col-major' else 'col-major'
pg.setConfigOptions(imageAxisOrder=altMode)
try:
test_ImageItem(transpose=True)
finally:
pg.setConfigOptions(imageAxisOrder=origMode)
示例4: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import setConfigOptions [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')
示例5: draw_net
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import setConfigOptions [as 别名]
def draw_net(self):
pg.setConfigOptions(antialias=True)
self.w = pg.GraphicsWindow() # Create new window like matplotlib pyplot
self.w.resize(800, 600)
self.w.setWindowTitle('Overlay Network of the Team')
self.v = self.w.addViewBox() # Add ViewBox that would contain all the graphics i.e graph structure
self.v.setAspectLocked()
self.G = Graph() # Child class of pg.GraphItem that would contain all the nodes and edges
self.v.addItem(self.G)
self.color_map = {'peer': (169, 188, 245, 255), 'monitor': (
169, 245, 208, 255), 'malicious': (247, 129, 129, 255)}
示例6: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import setConfigOptions [as 别名]
def __init__(self, parent=None, **kargs):
pg.GraphicsWindow.__init__(self, **kargs)
self.setParent(parent)
self.setWindowTitle('')
# Enable antialiasing for prettier plots
pg.setConfigOptions(antialias=True)
self.p6 = self.addPlot(title="")
self.curve = self.p6.plot(pen='r')
示例7: setPgConfigOptions
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import setConfigOptions [as 别名]
def setPgConfigOptions(**kwargs):
""" Sets the PyQtGraph config options and emits a log message
"""
for key, value in kwargs.items():
logger.debug("Setting PyQtGraph config option: {} = {}".format(key, value))
pg.setConfigOptions(**kwargs)
# Sets some config options
示例8: rowmajor_axisorder
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import setConfigOptions [as 别名]
def rowmajor_axisorder():
"""
Context manager that sets the PyQtGraph image axis order to row-major.
The environment is reset to the initial value after context close.
"""
old_image_axis_order = pg.getConfigOption("imageAxisOrder")
pg.setConfigOptions(imageAxisOrder="row-major")
yield
pg.setConfigOptions(imageAxisOrder=old_image_axis_order)
示例9: create_plot
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import setConfigOptions [as 别名]
def create_plot(title='Finance Plot', rows=1, init_zoom_periods=1e10, maximize=True, yscale='linear'):
global windows, last_ax
pg.setConfigOptions(foreground=foreground, background=background)
win = FinWindow(title)
windows.append(win)
if maximize:
win.showMaximized()
# normally first graph is of higher significance, so enlarge
win.ci.layout.setRowStretchFactor(0, top_graph_scale)
win.ci.setContentsMargins(0, 0, 0 ,0)
win.ci.setSpacing(0)
axs = []
prev_ax = None
for n in range(rows):
ysc = yscale[n] if type(yscale) in (list,tuple) else yscale
ysc = YScale(ysc, 1)
v_zoom_scale = 0.97
viewbox = FinViewBox(win, init_steps=init_zoom_periods, yscale=ysc, v_zoom_scale=v_zoom_scale)
ax = prev_ax = _add_timestamp_plot(win, prev_ax, viewbox=viewbox, index=n, yscale=ysc)
_set_plot_x_axis_leader(ax)
if n == 0:
viewbox.setFocus()
axs += [ax]
win.proxy_mmove = pg.SignalProxy(win.scene().sigMouseMoved, rateLimit=144, slot=partial(_mouse_moved, win))
win._last_mouse_evs = None
win._last_mouse_y = 0
last_ax = axs[0]
if len(axs) == 1:
return axs[0]
return axs
示例10: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import setConfigOptions [as 别名]
def __init__(self):
super().__init__()
# Set up layout
grid = QGridLayout()
self.setLayout(grid)
pg.setConfigOptions(antialias=False) # True seems to work as well
# Create pushbutton that resets the views
self.button = QPushButton('Reset All Zooms', self)
self.button.clicked.connect(self.handleButton)
grid.addWidget(self.button, 0, 0)
# create time plot
self.time_plot = pg.PlotWidget(labels={'left': 'Amplitude', 'bottom': 'Time [microseconds]'}, enableMenu=False)
self.time_plot.getPlotItem().getViewBox().setMouseMode(pg.ViewBox.RectMode)
self.time_plot.setMouseEnabled(x=False, y=True)
self.time_plot_curve_i = self.time_plot.plot([])
self.time_plot_curve_q = self.time_plot.plot([])
grid.addWidget(self.time_plot, 1, 0)
# create fft plot
self.fft_plot = pg.PlotWidget(labels={'left': 'PSD', 'bottom': 'Frequency [MHz]'}, enableMenu=False)
self.fft_plot.getPlotItem().getViewBox().setMouseMode(pg.ViewBox.RectMode)
self.fft_plot.setMouseEnabled(x=False, y=True)
self.fft_plot_curve_fft = self.fft_plot.plot([])
grid.addWidget(self.fft_plot, 2, 0)
# Create waterfall plot
self.waterfall = pg.PlotWidget(labels={'left': 'Time [s]', 'bottom': 'Frequency [MHz]'}, enableMenu=False)
self.waterfall.getPlotItem().getViewBox().translateBy(x=10.0)
self.imageitem = pg.ImageItem()
self.waterfall.addItem(self.imageitem)
self.waterfall.setMouseEnabled(x=False, y=False)
grid.addWidget(self.waterfall, 3, 0)
self.setGeometry(300, 300, 300, 220) # window placement and size
self.setWindowTitle('RTL-SDR Demo')
self.show() # not blocking