From 87a456ff5e353d3ce17a4b50a7de4d8d2a48e147 Mon Sep 17 00:00:00 2001 From: An Nguyen <39999966+anthng@users.noreply.github.com> Date: Sat, 1 Aug 2020 13:08:32 +0700 Subject: [PATCH 1/3] update plotly version 4.9.0 --- plotly_visualize.py | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/plotly_visualize.py b/plotly_visualize.py index 545f525..b3454bb 100644 --- a/plotly_visualize.py +++ b/plotly_visualize.py @@ -40,12 +40,12 @@ def visualize_graph(G, node_labels, node_sizes=[], edge_weights=[], layout="grap for edge in G.edges(): x0, y0 = positions[edge[0]] x1, y1 = positions[edge[1]] - edge_trace['x'] += [x0, x1, None] - edge_trace['y'] += [y0, y1, None] + edge_trace['x'] += tuple([x0, x1, None]) + edge_trace['y'] += tuple([y0, y1, None]) if edge_weights: for weight in edge_weights: - edge_trace['line']['width'].append(weight) + edge_trace['line']['width']+=tuple([weight]) else: edge_trace['line']['width'] = [1]*len(G.edges()) @@ -76,22 +76,21 @@ def visualize_graph(G, node_labels, node_sizes=[], edge_weights=[], layout="grap for node in G.nodes(): x, y = positions[node] - node_trace['x'].append(x) - node_trace['y'].append(y) - - for adjacencies in G.adjacency_list(): - node_trace['marker']['color'].append(len(adjacencies)) + node_trace['x'] += tuple([x]) + node_trace['y'] += tuple([y]) + + for adjacencies in G.adjacency(): + node_trace['marker']['color']+=tuple([len(adjacencies)]) if not node_labels: node_labels = G.nodes() for node in node_labels: - node_trace['text'].append(node) - + node_trace['text'] +=tuple([node]) if node_sizes: for size in node_sizes: - node_trace['marker']['size'].append(size) + node_trace['marker']['size']+=tuple([size]) else: node_trace['marker']['size'] = [1]*len(G.nodes()) @@ -155,27 +154,27 @@ def visualize_graph_3d(G, node_labels, node_sizes, filename, title="3d"): for edge in G.edges(): x0, y0, z0 = positions[edge[0]] x1, y1, z1 = positions[edge[1]] - edge_trace['x'] += [x0, x1, None] - edge_trace['y'] += [y0, y1, None] - edge_trace['z'] += [z0, z1, None] + edge_trace['x'] += tuple([x0, x1, None]) + edge_trace['y'] += tuple([y0, y1, None]) + edge_trace['z'] += tuple([z0, z1, None]) for node in G.nodes(): x, y, z = positions[node] - node_trace['x'].append(x) - node_trace['y'].append(y) - node_trace['z'].append(z) + node_trace['x'] += tuple([x]) + node_trace['y'] += tuple([y]) + node_trace['z'] += tuple([z]) - for adjacencies in G.adjacency_list(): - node_trace['marker']['color'].append(len(adjacencies)) + for adjacencies in G.adjacency(): + node_trace['marker']['color']+=tuple([len(adjacencies)]) for size in node_sizes: - node_trace['marker']['size'].append(size) + node_trace['marker']['size']+=tuple([size]) for node in node_labels: - node_trace['text'].append(node) + node_trace['text'] +=tuple([node]) axis = dict(showbackground=False, showline=False, From 0621b79c043d930231852233c46b4b35ad109162 Mon Sep 17 00:00:00 2001 From: An Nguyen <39999966+anthng@users.noreply.github.com> Date: Sat, 1 Aug 2020 13:23:32 +0700 Subject: [PATCH 2/3] Update requirements.txt --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 37f464f..b4add54 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ networkx==1.11 -plotly==2.0.16 +plotly==4.9.0 pygraphviz==1.3.1 -numpy \ No newline at end of file +numpy From 786e0ab53de0e5afd9cdae5f7ce6bac13d729b41 Mon Sep 17 00:00:00 2001 From: An Nguyen <39999966+anthng@users.noreply.github.com> Date: Sat, 1 Aug 2020 14:24:30 +0700 Subject: [PATCH 3/3] Update plotly_visualize.py --- plotly_visualize.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plotly_visualize.py b/plotly_visualize.py index b3454bb..7399fcd 100644 --- a/plotly_visualize.py +++ b/plotly_visualize.py @@ -45,7 +45,8 @@ def visualize_graph(G, node_labels, node_sizes=[], edge_weights=[], layout="grap if edge_weights: for weight in edge_weights: - edge_trace['line']['width']+=tuple([weight]) + #edge_trace['line']['width']+=tuple([weight]) + edge_trace['line']['width'] = weight else: edge_trace['line']['width'] = [1]*len(G.edges()) @@ -55,9 +56,9 @@ def visualize_graph(G, node_labels, node_sizes=[], edge_weights=[], layout="grap text=[], mode='markers+text', textfont=dict(family='Calibri (Body)', size=25, color='black'), - opacity=100, + opacity=1, # hoverinfo='text', - marker=Marker( + marker=dict( showscale=True, # colorscale options # 'Greys' | 'Greens' | 'Bluered' | 'Hot' | 'Picnic' | 'Portland' |