draw_shell#

draw_shell(G, nlist=None, **kwargs)[源代码]#

绘制网络X图 G 带外壳布局。

这是一个便利函数,相当于::

nx.draw(G, pos=nx.shell_layout(G, nlist=nlist), **kwargs)
参数
G图表

网络X图

nlist节点列表,可选

包含表示壳的节点列表的列表。默认值为 None 这意味着所有节点都在单个外壳中。看见 shell_layout 有关详细信息,请参阅。

kwargs可选关键字

看见 draw_networkx 有关可选关键字的说明,请参见。

笔记

每次调用此函数时都会计算布局。对于重复绘制,调用 shell_layout 直接和重复使用结果::

>>> G = nx.complete_graph(5)
>>> pos = nx.shell_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")