当前位置: 首页>>代码示例>>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;未经允许,请勿转载。