Skip to content
Discussion options

You must be logged in to vote

One way I found that was able to fix your issue is doing that

if analysis_graph.is_directed():
    my_pos = nx.spring_layout(analysis_graph.to_undirected(), seed=0) 
else:
    my_pos = nx.spring_layout(analysis_graph, seed=0)

That way you always compute the undirected graph's positions.

Other than that, you can store the my_pos object and pass it to both cases.

Finally, you can use another layout that isn't producing random positions.

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by dschult
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants