Skip to content

Instantly share code, notes, and snippets.

@saliksyed
Created July 4, 2017 11:41
Show Gist options
  • Save saliksyed/7dadbbef2d7adf49f27c6a21c669953d to your computer and use it in GitHub Desktop.
Save saliksyed/7dadbbef2d7adf49f27c6a21c669953d to your computer and use it in GitHub Desktop.
import json
import numpy as np
import matplotlib.pyplot as plt
graph_data = json.loads(open("routes.json").read())
belgium_count = []
switzerland_count = []
for start_country in graph_data:
data = graph_data[start_country]
if "Belgium" in data["to"]:
belgium_count.append(data["to"]["Belgium"])
else:
belgium_count.append(0)
if "Switzerland" in data["to"]:
switzerland_count.append(data["to"]["Switzerland"])
else:
switzerland_count.append(0)
x = belgium_count
y = switzerland_count
plt.scatter(x, y)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment