pyvis icon indicating copy to clipboard operation
pyvis copied to clipboard

Add initial position support to `Network.from_nx`

Open nikosavola opened this issue 3 years ago • 1 comments

In Networkx, you can give the positions to draw nodes at with

nx.draw(G, pos=nx.spring_layout(G))

See https://networkx.org/documentation/stable/reference/generated/networkx.drawing.nx_pylab.draw.html#networkx.drawing.nx_pylab.draw for more.

In pyvis, it would be useful add a pos argument to Network.from_nx. This would then map the positions to the x and y arguments of Network.add_node that are called in the implementation of from_nx. This way we could have a dictionary of initial positions similar to Networkx.

nikosavola avatar Jul 21 '21 09:07 nikosavola

Might duplicate or be similar to: https://github.com/WestHealth/pyvis/issues/17

BerserkerGaruk avatar Oct 21 '21 19:10 BerserkerGaruk