draw_circular#
- draw_circular(G, **kwargs)[source]#
使用圆形布局绘制图
G
。这是一个方便的函数,等同于
nx.draw(G, pos=nx.circular_layout(G), **kwargs)
- 参数:
- G图
一个 NetworkX 图
- kwargs可选关键字参数
有关可选关键字参数的说明,请参见
draw_networkx
。
另请参阅
注意
每次调用此函数时都会计算布局。对于重复绘制,直接调用
circular_layout
并重用结果会更有效率。>>> G = nx.complete_graph(5) >>> pos = nx.circular_layout(G) >>> nx.draw(G, pos=pos) # Draw the original graph >>> # Draw a subgraph, reusing the same node positions >>> nx.draw(G.subgraph([0, 1, 2]), pos=pos, node_color="red")
示例
>>> G = nx.path_graph(5) >>> nx.draw_circular(G)