From 5bb1b6bc4f7e16b177033796db037262fe21bbb1 Mon Sep 17 00:00:00 2001 From: Jaeseung Han Date: Fri, 17 Mar 2023 21:54:06 +0900 Subject: [PATCH] label position bug fix --- pygraphml/graph.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pygraphml/graph.py b/pygraphml/graph.py index 91bc0f5..927c53e 100644 --- a/pygraphml/graph.py +++ b/pygraphml/graph.py @@ -241,10 +241,11 @@ def show(self, show_label=False): n2_label = e.node2.id G.add_edge(n1_label, n2_label) - nx.draw(G) - + pos = None if show_label: - nx.draw_networkx_labels(G, pos=nx.spring_layout(G)) + pos = nx.spring_layout(G) + nx.draw_networkx_labels(G, pos=pos) + nx.draw(G, pos=pos) plt.show()