1

I have data that looks like this:

parsed_points = [(u'USD', u'JPY', -4.566), (u'USD', u'USD', -0.0), (u'JPY', u'EUR', 4.821), (u'BTC', `u'USD', -4.91), (u'JPY', u'BTC', 9.361), (u'USD', u'EUR', 0.314), (u'EUR', u'USD', -0.117), (u'EUR', u'JPY', -4.746), (u'JPY', u'USD', 4.57), (u'BTC', u'BTC', -0.0), (u'EUR', u'BTC', 4.621), (u'BTC', u'JPY', -9.539), (u'JPY', u'JPY', -0.0), (u'BTC', u'EUR', -4.606), (u'EUR', u'EUR', -0.0), (u'USD', u'BTC', 4.854)]`

As can be seen there are nodes with edges coming from and going to each node. The problem is that when I draw the nodes with networkx, the edges are on top of one another:

import networkx as nx
import matplotlib.pyplot as plt
...

parsed_points = map(parse_point, obj.items())
dg = build_graph(parsed_points)

pos = nx.spring_layout(dg, k = 0.95, iterations = 150)

nx.draw_networkx_edge_labels(dg, pos, edge_labels = edge_labels)
nx.draw(dg, pos, cmap = plt.get_cmap('jet'), node_color = values, node_size = 1500, edge_color = edge_colors, edge_cmap = plt.cm.Reds)

What is the solution to this problem? Perhaps use arcs instead of lines [if possible] for the edges?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.