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


Python networkx.draw_spring方法代码示例

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


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

示例1: draw_spring

# 需要导入模块: import networkx [as 别名]
# 或者: from networkx import draw_spring [as 别名]
def draw_spring(self, **kwargs):

        """
        Render a spring layout.
        """

        nx.draw_spring(
            self.graph,
            with_labels=True,
            font_size=10,
            edge_color='#dddddd',
            node_size=0,
            **kwargs
        )

        plt.show() 
开发者ID:davidmcclure,项目名称:textplot,代码行数:18,代码来源:graphs.py

示例2: test_draw

# 需要导入模块: import networkx [as 别名]
# 或者: from networkx import draw_spring [as 别名]
def test_draw(self):
        try:
            N=self.G
            nx.draw_spring(N)
            plt.savefig("test.ps")
            nx.draw_random(N)
            plt.savefig("test.ps")
            nx.draw_circular(N)
            plt.savefig("test.ps")
            nx.draw_spectral(N)
            plt.savefig("test.ps")
            nx.draw_spring(N.to_directed())
            plt.savefig("test.ps")
        finally:
            try:
                os.unlink('test.ps')
            except OSError:
                pass 
开发者ID:SpaceGroupUCL,项目名称:qgisSpaceSyntaxToolkit,代码行数:20,代码来源:test_pylab.py

示例3: test_draw

# 需要导入模块: import networkx [as 别名]
# 或者: from networkx import draw_spring [as 别名]
def test_draw(self):
        try:
            functions = [nx.draw_circular,
                         nx.draw_kamada_kawai,
                         nx.draw_planar,
                         nx.draw_random,
                         nx.draw_spectral,
                         nx.draw_spring,
                         nx.draw_shell]
            options = [{
                'node_color': 'black',
                'node_size': 100,
                'width': 3,
            }]
            for function, option in itertools.product(functions, options):
                function(self.G, **option)
                plt.savefig('test.ps')

        finally:
            try:
                os.unlink('test.ps')
            except OSError:
                pass 
开发者ID:holzschu,项目名称:Carnets,代码行数:25,代码来源:test_pylab.py

示例4: test_draw

# 需要导入模块: import networkx [as 别名]
# 或者: from networkx import draw_spring [as 别名]
def test_draw(self):
        try:
            functions = [nx.draw_circular,
                         nx.draw_kamada_kawai,
                         nx.draw_random,
                         nx.draw_spectral,
                         nx.draw_spring,
                         nx.draw_shell]
            options = [{
                           'node_color': 'black',
                           'node_size': 100,
                           'width': 3,
                       }]
            for function, option in itertools.product(functions, options):
                function(self.G, **option)
                plt.savefig('test.ps')

        finally:
            try:
                os.unlink('test.ps')
            except OSError:
                pass 
开发者ID:aws-samples,项目名称:aws-kube-codesuite,代码行数:24,代码来源:test_pylab.py

示例5: test_edge_colormap

# 需要导入模块: import networkx [as 别名]
# 或者: from networkx import draw_spring [as 别名]
def test_edge_colormap(self):
        colors = range(self.G.number_of_edges())
        nx.draw_spring(self.G, edge_color=colors, width=4,
                       edge_cmap=plt.cm.Blues, with_labels=True)
        plt.show() 
开发者ID:holzschu,项目名称:Carnets,代码行数:7,代码来源:test_pylab.py

示例6: test_arrows

# 需要导入模块: import networkx [as 别名]
# 或者: from networkx import draw_spring [as 别名]
def test_arrows(self):
        nx.draw_spring(self.G.to_directed())
        plt.show() 
开发者ID:holzschu,项目名称:Carnets,代码行数:5,代码来源:test_pylab.py

示例7: plot_graph

# 需要导入模块: import networkx [as 别名]
# 或者: from networkx import draw_spring [as 别名]
def plot_graph(self, ax=None):
        """
        Plot the grid.
        :param ax: Matplotlib axis object
        :return:
        """
        if ax is None:
            fig = plt.figure()
            ax = fig.add_subplot(111)

        if self.graph is None:
            self.build_graph()

        nx.draw_spring(self.graph, ax=ax) 
开发者ID:SanPen,项目名称:GridCal,代码行数:16,代码来源:multi_circuit.py


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