diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2015-08-23 03:47:58 -0700 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2015-08-23 03:47:58 -0700 |
| commit | 0b0d26b2c0ed7d6f0b69f550f6584dabae184ba1 (patch) | |
| tree | b21a4b25d907d8106ce4189d8a770acd6abe457f /hawkes/plot.py | |
| parent | ef61ece9773e8a865b57f60ca1e1b9faa903af23 (diff) | |
| download | criminal_cascades-0b0d26b2c0ed7d6f0b69f550f6584dabae184ba1.tar.gz | |
Code for hawkes model
Diffstat (limited to 'hawkes/plot.py')
| -rw-r--r-- | hawkes/plot.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/hawkes/plot.py b/hawkes/plot.py new file mode 100644 index 0000000..24d3f35 --- /dev/null +++ b/hawkes/plot.py @@ -0,0 +1,26 @@ +from mpl_toolkits.mplot3d import Axes3D +from matplotlib import cm +import matplotlib.pyplot as plt + +fig = plt.figure() +ax = fig.gca(projection='3d') +d = {} +for line in open("values.txt"): + v = map(float, line.strip().split()) + try: + if (v[0], v[2]) in d: + d[(v[0], v[2])] = min(d[(v[0], v[2])], v[3]) + else: + d[(v[0], v[2])] = v[3] + except: + continue + +x, y, z = [], [], [] +for k, v in d.iteritems(): + x.append(k[0] / 1000000.) + y.append(k[1] / 1000000.) + z.append(v / 100000.) + +print x +surf = ax.plot_trisurf(x, y, z) +plt.show() |
