Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update plotly version 4.9.0 #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions plotly_visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ 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])
edge_trace['line']['width'] = weight
else:
edge_trace['line']['width'] = [1]*len(G.edges())

Expand All @@ -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' |
Expand All @@ -76,22 +77,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())

Expand Down Expand Up @@ -155,27 +155,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,
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
networkx==1.11
plotly==2.0.16
plotly==4.9.0
pygraphviz==1.3.1
numpy
numpy