當前位置: 首頁>>代碼示例>>Python>>正文


Python pyqtgraph.GraphItem方法代碼示例

本文整理匯總了Python中pyqtgraph.GraphItem方法的典型用法代碼示例。如果您正苦於以下問題:Python pyqtgraph.GraphItem方法的具體用法?Python pyqtgraph.GraphItem怎麽用?Python pyqtgraph.GraphItem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pyqtgraph的用法示例。


在下文中一共展示了pyqtgraph.GraphItem方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: makeGraph

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import GraphItem [as 別名]
def makeGraph(self):
        #g1 = pg.GraphItem(pos=self.pos, adj=self.links[self.rope], pen=0.2, symbol=None)
        brushes = np.where(self.fixed, pg.mkBrush(0,0,0,255), pg.mkBrush(50,50,200,255))
        g2 = pg.GraphItem(pos=self.pos, adj=self.links[self.push & self.pull], pen=0.5, brush=brushes, symbol='o', size=(self.mass**0.33), pxMode=False)
        p = pg.ItemGroup()
        #p.addItem(g1)
        p.addItem(g2)
        return p 
開發者ID:SrikanthVelpuri,項目名稱:tf-pose,代碼行數:10,代碼來源:chain.py

示例2: __init__

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import GraphItem [as 別名]
def __init__(self):
        self.dragPoint = None
        self.dragOffset = None
        self.textItems = []
        pg.GraphItem.__init__(self)
        self.scatter.sigClicked.connect(self.clicked) 
開發者ID:SrikanthVelpuri,項目名稱:tf-pose,代碼行數:8,代碼來源:CustomGraphItem.py

示例3: updateGraph

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import GraphItem [as 別名]
def updateGraph(self):
        pg.GraphItem.setData(self, **self.data)
        for i,item in enumerate(self.textItems):
            item.setPos(*self.data['pos'][i]) 
開發者ID:SrikanthVelpuri,項目名稱:tf-pose,代碼行數:6,代碼來源:CustomGraphItem.py

示例4: add_trans

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import GraphItem [as 別名]
def add_trans(self, tns_dict):
        """
        添加事務畫線
        {'start_time','end_time','tns_type','start_price','end_price','start_x','end_x','completed'}
        :return:
        """
        if len(self.datas)==0:
            print(u'No datas exist',file=sys.stderr)
            return
        tns = copy.copy(tns_dict)

        completed = tns.get('completed', False)
        end_price = tns.get('end_price',0)
        if not completed:
            end_x = len(self.datas) -1
            end_price = self.datas[end_x]['close']
            tns['end_x'] = end_x
            tns['end_price'] = end_price
            tns['completed'] = False
        else:
            tns['end_x'] = self.axisTime.get_x_by_time(tns['end_time'])

        tns['start_x'] = self.axisTime.get_x_by_time(tns['start_time'])
        # 將上一個線段設置為True
        if len(self.list_trans) > 0:
            self.list_trans[-1]['completed'] = True
        pos = np.array([[tns['start_x'],tns['start_price']],[tns['end_x'],tns['end_price']]])

        tns_line = pg.GraphItem(pos=pos, adj=np.array([[0,1]]))
        self.pi_main.addItem(tns_line)
        self.list_trans.append(tns) 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:33,代碼來源:uiKLine.py

示例5: draw_net

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import GraphItem [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)} 
開發者ID:P2PSP,項目名稱:simulator,代碼行數:13,代碼來源:play.py

示例6: __init__

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import GraphItem [as 別名]
def __init__(self):
        self.textItems = []
        pg.GraphItem.__init__(self)
        self.pos = []
        self.edges = [[0, 0]]    # edges should have atleast one edge else it will throw error
        self.texts = []
        self.V = 0
        self.lineColor = []
        self.nodeColors = []

    # Clear previous data and set new data, it is overrided to update nodes labels 
開發者ID:P2PSP,項目名稱:simulator,代碼行數:13,代碼來源:qtGraph.py

示例7: updateGraph

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import GraphItem [as 別名]
def updateGraph(self):
        pg.GraphItem.setData(self, **self.data)
        for i, item in enumerate(self.textItems):
            item.setPos(*self.data['pos'][i]) 
開發者ID:P2PSP,項目名稱:simulator,代碼行數:6,代碼來源:qtGraph.py

示例8: _qtg_plot_graph

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import GraphItem [as 別名]
def _qtg_plot_graph(G, edges, vertex_size, title):

    qtg, gl, QtGui = _import_qtg()

    if G.coords.shape[1] == 2:

        window = qtg.GraphicsWindow()
        window.setWindowTitle(title)
        view = window.addViewBox()
        view.setAspectLocked()

        if edges:
            pen = tuple(np.array(G.plotting['edge_color']) * 255)
        else:
            pen = None

        adj = _get_coords(G, edge_list=True)

        g = qtg.GraphItem(pos=G.coords, adj=adj, pen=pen,
                          size=vertex_size/10)
        view.addItem(g)

        global _qtg_windows
        _qtg_windows.append(window)

    elif G.coords.shape[1] == 3:
        if not QtGui.QApplication.instance():
            QtGui.QApplication([])  # We want only one application.
        widget = gl.GLViewWidget()
        widget.opts['distance'] = 10
        widget.show()
        widget.setWindowTitle(title)

        if edges:
            x, y, z = _get_coords(G)
            pos = np.stack((x, y, z), axis=1)
            g = gl.GLLinePlotItem(pos=pos, mode='lines',
                                  color=G.plotting['edge_color'])
            widget.addItem(g)

        gp = gl.GLScatterPlotItem(pos=G.coords, size=vertex_size/3,
                                  color=G.plotting['vertex_color'])
        widget.addItem(gp)

        global _qtg_widgets
        _qtg_widgets.append(widget) 
開發者ID:epfl-lts2,項目名稱:pygsp,代碼行數:48,代碼來源:plotting.py

示例9: _qtg_plot_signal

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import GraphItem [as 別名]
def _qtg_plot_signal(G, signal, edges, vertex_size, limits, title):

    qtg, gl, QtGui = _import_qtg()

    if G.coords.shape[1] == 2:
        window = qtg.GraphicsWindow(title)
        view = window.addViewBox()

    elif G.coords.shape[1] == 3:
        if not QtGui.QApplication.instance():
            QtGui.QApplication([])  # We want only one application.
        widget = gl.GLViewWidget()
        widget.opts['distance'] = 10
        widget.show()
        widget.setWindowTitle(title)

    if edges:

        if G.coords.shape[1] == 2:
            adj = _get_coords(G, edge_list=True)
            pen = tuple(np.array(G.plotting['edge_color']) * 255)
            g = qtg.GraphItem(pos=G.coords, adj=adj, symbolBrush=None,
                              symbolPen=None, pen=pen)
            view.addItem(g)

        elif G.coords.shape[1] == 3:
            x, y, z = _get_coords(G)
            pos = np.stack((x, y, z), axis=1)
            g = gl.GLLinePlotItem(pos=pos, mode='lines',
                                  color=G.plotting['edge_color'])
            widget.addItem(g)

    pos = [1, 8, 24, 40, 56, 64]
    color = np.array([[0, 0, 143, 255], [0, 0, 255, 255], [0, 255, 255, 255],
                      [255, 255, 0, 255], [255, 0, 0, 255], [128, 0, 0, 255]])
    cmap = qtg.ColorMap(pos, color)

    signal = 1 + 63 * (signal - limits[0]) / limits[1] - limits[0]

    if G.coords.shape[1] == 2:
        gp = qtg.ScatterPlotItem(G.coords[:, 0],
                                 G.coords[:, 1],
                                 size=vertex_size/10,
                                 brush=cmap.map(signal, 'qcolor'))
        view.addItem(gp)

    if G.coords.shape[1] == 3:
        gp = gl.GLScatterPlotItem(pos=G.coords,
                                  size=vertex_size/3,
                                  color=cmap.map(signal, 'float'))
        widget.addItem(gp)

    if G.coords.shape[1] == 2:
        global _qtg_windows
        _qtg_windows.append(window)
    elif G.coords.shape[1] == 3:
        global _qtg_widgets
        _qtg_widgets.append(widget) 
開發者ID:epfl-lts2,項目名稱:pygsp,代碼行數:60,代碼來源:plotting.py


注:本文中的pyqtgraph.GraphItem方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。