|
@@ -0,0 +1,61 @@
|
|
1
|
+import numpy as np
|
|
2
|
+import matplotlib.pyplot as plt
|
|
3
|
+from mpl_toolkits.mplot3d import Axes3D
|
|
4
|
+from mpl_toolkits.mplot3d import proj3d
|
|
5
|
+
|
|
6
|
+data = [
|
|
7
|
+ ["SAT0", 1346.496594546033, -6631.509574249269, -1784.401979591288],
|
|
8
|
+ ["SAT1", 3986.6137971140965, -4309.794821125442, 3652.552861361319],
|
|
9
|
+ ["SAT2", 6066.873731024742, 1768.4246674363346, -2645.6457201477174],
|
|
10
|
+ ["SAT3", -531.4244577628424, -5725.907186159696, -3873.2462304175233],
|
|
11
|
+ ["SAT4", -3029.294804348662, -6060.24715150741, -1163.1126511352572],
|
|
12
|
+ ["SAT5", 4235.879179136093, -5048.655863634309, -1330.5861403372983],
|
|
13
|
+ ["SAT6", -3213.176589077265, -4782.048496222451, -3740.7862955786086],
|
|
14
|
+ ["SAT7", 176.0460873300058, 488.53751332601894, -6717.752685099294],
|
|
15
|
+ ["SAT8", 286.49182959607276, 19.39475455789748, -6993.120858082854],
|
|
16
|
+ ["SAT9", 6399.451382476649, -2113.9916687975474, -2002.7547869095122],
|
|
17
|
+ ["SAT10", 3257.7488038015017, 1981.1452195906668, -5821.828870417848],
|
|
18
|
+ ["SAT11", -581.1213836443779, 3374.6766339195256, 5964.093711437812],
|
|
19
|
+ ["SAT12", 217.1789623719815, 178.85016316224656, -6843.305647372251],
|
|
20
|
+ ["SAT13", 1176.6725366453472, -4957.9575328468, 4380.506198321206],
|
|
21
|
+ ["SAT14", -1068.982383556387, 526.9728758308576, 6575.590264183411],
|
|
22
|
+ ["SAT15", 1165.7614133253296, 584.8807748235947, 6545.811084796057],
|
|
23
|
+ ["SAT16", -5993.097263023728, 2437.0166813209858, 2726.5808375640754],
|
|
24
|
+ ["SAT17", -219.2118047031717, -105.032581318871, -6728.36026711676],
|
|
25
|
+ ["SAT18", 3868.5717603149724, 4556.803440191685, -3214.801047688104],
|
|
26
|
+ ["SAT19", 55.609142839530044, -1439.9935335382188, -6839.854023068437],
|
|
27
|
+ ["Start", -2633.5917604717556, -5669.215907008842, -1230.3765435398993],
|
|
28
|
+ ["End", -5854.876300459916, -190.38043902511365, -2504.759428517919]
|
|
29
|
+]
|
|
30
|
+x = [a[1] for a in data]
|
|
31
|
+y = [a[2] for a in data]
|
|
32
|
+z = [a[3] for a in data]
|
|
33
|
+names = [a[0] for a in data]
|
|
34
|
+
|
|
35
|
+fig = plt.figure()
|
|
36
|
+ax = fig.add_subplot(111, projection='3d')
|
|
37
|
+
|
|
38
|
+ax.scatter(x,y,z)
|
|
39
|
+
|
|
40
|
+plotlabels = []
|
|
41
|
+for name,xi,yi,zi in zip(names,x,y,z):
|
|
42
|
+ x2, y2, _ = proj3d.proj_transform(xi,yi,zi, ax.get_proj())
|
|
43
|
+ h = plt.annotate(name, xy = (x2,y2), xytext=(-20,20), textcoords='offset points', ha = 'right', va = 'bottom',
|
|
44
|
+ bbox = dict(boxstyle = 'round,pad=0.5', fc = 'yellow', alpha = 0.5),
|
|
45
|
+ arrowprops = dict(arrowstyle = '-', connectionstyle = 'arc3,rad=0'))
|
|
46
|
+ plotlabels.append(h)
|
|
47
|
+
|
|
48
|
+def update_position(e):
|
|
49
|
+ for h,xi,yi,zi in zip(plotlabels, x, y, z):
|
|
50
|
+ x2, y2, _ = proj3d.proj_transform(xi,yi,zi, ax.get_proj())
|
|
51
|
+ h.xy = x2,y2
|
|
52
|
+ h.update_positions(fig.canvas.renderer)
|
|
53
|
+ fig.canvas.draw()
|
|
54
|
+
|
|
55
|
+fig.canvas.mpl_connect('motion_notify_event', update_position)
|
|
56
|
+
|
|
57
|
+ax.set_xlabel('X')
|
|
58
|
+ax.set_ylabel('Y')
|
|
59
|
+ax.set_zlabel('Z')
|
|
60
|
+
|
|
61
|
+plt.show()
|