draw_random#
- draw_random(G, **kwargs)[源代码]#
画出图表
G
有一个随机布局。这是一个便利函数,相当于::
nx.draw(G, pos=nx.random_layout(G), **kwargs)
- 参数
- G图表
网络X图
- kwargs可选关键字
看见
draw_networkx
有关可选关键字的说明,请参见。
笔记
每次调用此函数时都会计算布局。对于重复绘制,调用
random_layout
直接和重复使用结果::>>> G = nx.complete_graph(5) >>> pos = nx.random_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")