当前位置: 首页>>代码示例>>Python>>正文


Python pyqtgraph.GraphicsLayoutWidget方法代码示例

本文整理汇总了Python中pyqtgraph.GraphicsLayoutWidget方法的典型用法代码示例。如果您正苦于以下问题:Python pyqtgraph.GraphicsLayoutWidget方法的具体用法?Python pyqtgraph.GraphicsLayoutWidget怎么用?Python pyqtgraph.GraphicsLayoutWidget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyqtgraph的用法示例。


在下文中一共展示了pyqtgraph.GraphicsLayoutWidget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: plot_team

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsLayoutWidget [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() 
开发者ID:P2PSP,项目名称:simulator,代码行数:27,代码来源:play.py

示例2: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsLayoutWidget [as 别名]
def __init__(self, layout):
        if not isinstance(layout, pg.GraphicsLayoutWidget):
            raise ValueError("layout must be instance of pyqtgraph.GraphicsLayoutWidget")

        self.layout = layout

        self.main_curve = True
        self.main_color = pg.mkColor("y")
        self.persistence = False
        self.persistence_length = 5
        self.persistence_decay = "exponential"
        self.persistence_color = pg.mkColor("g")
        self.persistence_data = None
        self.persistence_curves = None
        self.peak_hold_max = False
        self.peak_hold_max_color = pg.mkColor("r")
        self.peak_hold_min = False
        self.peak_hold_min_color = pg.mkColor("b")
        self.average = False
        self.average_color = pg.mkColor("c")
        self.baseline = False
        self.baseline_color = pg.mkColor("m")

        self.create_plot() 
开发者ID:xmikos,项目名称:qspectrumanalyzer,代码行数:26,代码来源:plot.py

示例3: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsLayoutWidget [as 别名]
def __init__(self, controller=None, parent=None):
        WidgetBase.__init__(self, parent=parent, controller=controller)
        
        self.layout = QT.QVBoxLayout()
        self.setLayout(self.layout)
        
        h = QT.QHBoxLayout()
        self.layout.addLayout(h)

        but = QT.QPushButton('settings')
        but.clicked.connect(self.open_settings)
        h.addWidget(but)

        but = QT.QPushButton('compute')
        but.clicked.connect(self.compute_ccg)
        h.addWidget(but)
        
        self.grid = pg.GraphicsLayoutWidget()
        self.layout.addWidget(self.grid)
        
        self.ccg = None 
开发者ID:tridesclous,项目名称:tridesclous,代码行数:23,代码来源:crosscorrelogramviewer.py

示例4: callback_analysis_graph_data_checked

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsLayoutWidget [as 别名]
def callback_analysis_graph_data_checked(self, curve_name_with_data):
        color_list = [(255, 0, 0), 
                      (0, 255, 0), 
                      (0, 0, 255),
                      (0, 255, 255),
                      (255, 0, 255), 
                      (155, 0, 160),
                      (0, 155, 155)]
        curve_name, data = curve_name_with_data
        data_type = data[0]
        if curve_name not in self.analysis_graph_list:
            new_graph = pg.GraphicsLayoutWidget()
            ax = new_graph.addPlot(row=0, col=0) 
            ax.addLegend()
            self.analysis_graph_list[curve_name] = new_graph
            self.default_tab.addTab(new_graph, curve_name)
            self.default_tab.setCurrentWidget(new_graph)
            for ind, curve_data in enumerate(data[1:]):
                ax.plot(curve_data[0], curve_data[1], pen=color_list[ind%len(color_list)], name=curve_data[2]) 
开发者ID:Marxlp,项目名称:pyFlightAnalysis,代码行数:21,代码来源:analysis.py

示例5: callback_graph_index_combobox_changed

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsLayoutWidget [as 别名]
def callback_graph_index_combobox_changed(self, index):
        """Add clicked config graph to Data plotting area"""
        print(index)
#         if index == self.graph_number:
#             # choose new
#             self.graph_number += 1
#             # add a graph
#             graph_widget = pg.GraphicsLayoutWidget()
#             graph_widget.addPlot(row=0, col=0)
#             self.graph_lines_dict.setdefault(graph_widget, 0)
#             for data in self.data_plotting:
#                 data[1].clear()
#                 for i in range(1, self.graph_number + 1):
#                     data[1].addItem(str(i))
#                 data[1].addItem('New')
#         else:
#             # change current curve's graph
#             pass 
开发者ID:Marxlp,项目名称:pyFlightAnalysis,代码行数:20,代码来源:analysis.py

示例6: draw_predefined_graph

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsLayoutWidget [as 别名]
def draw_predefined_graph(self, name):
        
        def add_context_action(ax):
            def callback(*args, **kargs):
                for item in ax.items():
                    if isinstance(item, pg.PlotDataItem):
                        if item.opts['symbol'] is None:
                            item.setData(item.xData, item.yData, symbol='s')
                        else:
                            item.setData(item.xData, item.yData, symbol=None) 
            return callback
        
        if name == 'XY_Estimation':
            graph_xy =  pg.GraphicsLayoutWidget()
            self.default_tab.addTab(graph_xy, name)
            ax = graph_xy.addPlot(row=0, col=0)
            show_marker_action = QtGui.QAction('show/hide marker', graph_xy)
            show_marker_action.triggered.connect(add_context_action(ax))
            data_index = list(list(self.data_dict.keys())).index('vehicle_local_position')
            x = self.log_data_list[data_index].data['x']
            y = self.log_data_list[data_index].data['y']
            # plot the xy trace line in red
            ax.plot(x, y, pen=(255, 0, 0)) 
开发者ID:Marxlp,项目名称:pyFlightAnalysis,代码行数:25,代码来源:analysis.py

示例7: make_colorbar

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsLayoutWidget [as 别名]
def make_colorbar(parent, b0):
    colorbarW = pg.GraphicsLayoutWidget(parent)
    colorbarW.setMaximumHeight(60)
    colorbarW.setMaximumWidth(150)
    colorbarW.ci.layout.setRowStretchFactor(0, 2)
    colorbarW.ci.layout.setContentsMargins(0, 0, 0, 0)
    parent.l0.addWidget(colorbarW, b0, 0, 1, 2)
    parent.colorbar = pg.ImageItem()
    cbar = colorbarW.addViewBox(row=0, col=0, colspan=3)
    cbar.setMenuEnabled(False)
    cbar.addItem(parent.colorbar)
    parent.clabel = [
        colorbarW.addLabel("0.0", color=[255, 255, 255], row=1, col=0),
        colorbarW.addLabel("0.5", color=[255, 255, 255], row=1, col=1),
        colorbarW.addLabel("1.0", color=[255, 255, 255], row=1, col=2),
    ] 
开发者ID:MouseLand,项目名称:suite2p,代码行数:18,代码来源:masks.py

示例8: run

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsLayoutWidget [as 别名]
def run(self):
        app = QtGui.QApplication([])
        ## Create window with GraphicsView widget
        win = pg.GraphicsLayoutWidget()
        win.show()  ## show widget alone in its own window
        win.setWindowTitle('pyqtgraph example: ImageItem')
        view = win.addViewBox()

        ## lock the aspect ratio so pixels are always square
        view.setAspectLocked(True)

        ## Create image item
        self.img = pg.ImageItem(border='w')
        view.addItem(self.img)

        ## Set initial view bounds
        view.setRange(QtCore.QRectF(0, 0, 2*self.image_hw, self.image_hw))

        timer = QtCore.QTimer()
        timer.timeout.connect(self._update)
        timer.start(50)

        app.exec_() 
开发者ID:udacity,项目名称:RoboND-DeepLearning-Project,代码行数:25,代码来源:visualization.py

示例9: setupGUI

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsLayoutWidget [as 别名]
def setupGUI(self):
        self.layout = QtGui.QVBoxLayout()
        self.layout.setContentsMargins(0,0,0,0)
        self.setLayout(self.layout)
        self.splitter = QtGui.QSplitter()
        self.splitter.setOrientation(QtCore.Qt.Horizontal)
        self.layout.addWidget(self.splitter)
        
        self.tree = ParameterTree(showHeader=False)
        self.splitter.addWidget(self.tree)
        
        self.splitter2 = QtGui.QSplitter()
        self.splitter2.setOrientation(QtCore.Qt.Vertical)
        self.splitter.addWidget(self.splitter2)
        
        self.worldlinePlots = pg.GraphicsLayoutWidget()
        self.splitter2.addWidget(self.worldlinePlots)
        
        self.animationPlots = pg.GraphicsLayoutWidget()
        self.splitter2.addWidget(self.animationPlots)
        
        self.splitter2.setSizes([int(self.height()*0.8), int(self.height()*0.2)])
        
        self.inertWorldlinePlot = self.worldlinePlots.addPlot()
        self.refWorldlinePlot = self.worldlinePlots.addPlot()
        
        self.inertAnimationPlot = self.animationPlots.addPlot()
        self.inertAnimationPlot.setAspectLocked(1)
        self.refAnimationPlot = self.animationPlots.addPlot()
        self.refAnimationPlot.setAspectLocked(1)
        
        self.inertAnimationPlot.setXLink(self.inertWorldlinePlot)
        self.refAnimationPlot.setXLink(self.refWorldlinePlot) 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:35,代码来源:relativity.py

示例10: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsLayoutWidget [as 别名]
def __init__(self):
        pg.GraphicsLayoutWidget.__init__(self, parent=None)

        # Set 0 margin 0 spacing to cover the whole area.
        self.centralWidget.setContentsMargins(0, 0, 0, 0)
        self.centralWidget.setSpacing(0)

        self.section_items = [] 
开发者ID:MTG,项目名称:dunya-desktop,代码行数:10,代码来源:waveformwidget.py

示例11: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsLayoutWidget [as 别名]
def __init__(self, parent=None):
        pg.GraphicsLayoutWidget.__init__(self, parent)

        # Set 0 margin 0 spacing to cover the whole area.
        self.centralWidget.setContentsMargins(0, 0, 0, 0)
        self.centralWidget.setSpacing(0)

        self.limit = 600  # maximum number of samples to be plotted
        self.rois = []

        # flags
        self.is_pitch_plotted = False
        self.is_notes_added = False 
开发者ID:MTG,项目名称:dunya-desktop,代码行数:15,代码来源:timeserieswidget.py

示例12: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsLayoutWidget [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') 
开发者ID:ocelot-collab,项目名称:ocelot,代码行数:38,代码来源:twiss_plot.py

示例13: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsLayoutWidget [as 别名]
def __init__(self, sandbox, *args, **kwargs):
        pg.GraphicsLayoutWidget.__init__(self, **kwargs)
        self.sandbox = sandbox

        self.plots = [
                DisplacementPlot(
                    sandbox,
                    title='North',
                    component=lambda m: m.north),
                DisplacementPlot(
                    sandbox,
                    title='East',
                    component=lambda m: m.east),
                DisplacementVectorPlot(
                    sandbox,
                    title='Down',
                    component=lambda m: m.down),
                DisplacementPlot(
                    sandbox,
                    title='LOS',
                    component=lambda m: m.displacement)
            ]

        for plt in self.plots:
            plt.vb.menu = QtWidgets.QMenu(self)

        self.updateViews()
        getConfig().qconfig.updated.connect(self.updateViews)

        self._mov_sig = pg.SignalProxy(
            self.scene().sigMouseMoved,
            rateLimit=60, slot=self.mouseMoved) 
开发者ID:pyrocko,项目名称:kite,代码行数:34,代码来源:multiplot.py

示例14: resizeEvent

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsLayoutWidget [as 别名]
def resizeEvent(self, ev):
        pg.GraphicsLayoutWidget.resizeEvent(self, ev)
        if hasattr(self, 'plots'):
            viewbox = self.plots[0].getViewBox()
            viewbox.autoRange() 
开发者ID:pyrocko,项目名称:kite,代码行数:7,代码来源:multiplot.py

示例15: draw_buffer

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import GraphicsLayoutWidget [as 别名]
def draw_buffer(self):
        self.buff_win = pg.GraphicsLayoutWidget()
        self.buff_win.setWindowTitle('Buffer Status')
        self.buff_win.resize(800, 700)

        self.total_peers = self.number_of_monitors + self.number_of_peers + self.number_of_malicious
        self.p4 = self.buff_win.addPlot()
        self.p4.showGrid(x=True, y=True, alpha=100)   # To show grid lines across x axis and y axis
        leftaxis = self.p4.getAxis('left')  # get left axis i.e y axis
        leftaxis.setTickSpacing(5, 1)    # to set ticks at a interval of 5 and grid lines at 1 space

        # Get different colors using matplotlib library
        if self.total_peers < 8:
            colors = cm.Set2(np.linspace(0, 1, 8))
        elif self.total_peers < 12:
            colors = cm.Set3(np.linspace(0, 1, 12))
        else:
            colors = cm.rainbow(np.linspace(0, 1, self.total_peers+1))
        self.QColors = [pg.hsvColor(color[0], color[1], color[2], color[3])
                        for color in colors]   # Create QtColors, each color would represent a peer

        self.Data = []  # To represent buffer out  i.e outgoing data from buffer
        self.OutData = []   # To represent buffer in i.e incoming data in buffer

        # a single line would reperesent a single color or peer, hence we would not need to pass a list of brushes
        self.lineIN = [None]*self.total_peers
        for ix in range(self.total_peers):
            self.lineIN[ix] = self.p4.plot(pen=(None), symbolBrush=self.QColors[ix], name='IN', symbol='o', clear=False)
            self.Data.append(set())
            self.OutData.append(set())

        # similiarly one line per peer to represent outgoinf data from buffer
        self.lineOUT = self.p4.plot(pen=(None), symbolBrush=mkColor('#CCCCCC'), name='OUT', symbol='o', clear=False)
        self.p4.setRange(xRange=[0, self.total_peers], yRange=[0, self.get_buffer_size()])
        self.buff_win.show()    # To actually show create window

        self.buffer_order = {}
        self.buffer_index = 0
        self.buffer_labels = []
        self.lastUpdate = pg.ptime.time()
        self.avgFps = 0.0 
开发者ID:P2PSP,项目名称:simulator,代码行数:43,代码来源:play.py


注:本文中的pyqtgraph.GraphicsLayoutWidget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。