'Visualization for a network
Some background to what I am trying to do. I have a list of 43 unique countries and the distance of each country to the other in terms of miles. The data set looks like this :
| Origin | Destination | Distance |
|---|---|---|
| UK | Canada | 2000 |
Now, with 43 countries I have 903 unique combinations.
I want to vizualize each connection with the length of the line between each country representing the distance and anything over three thousand miles has the line in red.
Currently, I am using the following snippet of code which utilizes the matplotlib and networkx packages:
G = nx.from_pandas_edgelist(data,'Origin','Destination',edge_attr = 'Distance')
plt.figure(figsize=(100,90))
pos = nx.random_layout(G)
nx.draw_networkx(G,pos)
greater_than_6_hrs = [x for x in G.edges(data=True) if x[2]['Distance']>3300]
nx.draw_networkx_edges(G, pos, edgelist=greater_than_6_hrs, edge_color='r', alpha=0.4, width=25)
This generates an image like so :
This image does not tell us anything. I was looking for help on how to create a meaningful visualization. Is there any package anyone can recommend for this sort of thing or point me in the right direction?
Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
