forked from jackzhenguo/python-small-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdraw_route.py
More file actions
73 lines (65 loc) · 1.21 KB
/
draw_route.py
File metadata and controls
73 lines (65 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import matplotlib.pyplot as plt
import turtle as p
lat = [
30.42642,
30.40874,
30.41054,
30.33076,
30.34913,
30.37498,
30.37501,
30.37501,
30.37501,
30.37651,
30.37399,
30.3823,
30.39114,
30.40265,
30.429,
30.43278,
30.28439,
30.28439,
30.28439,
30.28379
]
lng = [
103.99214,
103.98516,
103.98321,
103.95224,
104.03915,
104.05311,
104.05316,
104.05316,
104.05316,
104.05576,
104.05416,
104.16558,
104.17339,
104.14988,
104.20051,
104.20075,
104.11849,
104.11849,
104.11849,
104.12141
]
begin_lat_lng = (30.63572, 103.92430)
# p.pu() # 抬起画笔
# p.goto(begin_lat_lng) # 起始位置
# p.color('red') # 绘制
# p.pensize(3) # 画笔尺寸设置3
# for x, y in zip(lat, lng):
# p.pd() # 放下画笔
# p.goto(x, y)
# p.pu()
# print(x, y)
# p.done()
lat.insert(0, begin_lat_lng[0])
lng.insert(0, begin_lat_lng[1])
plt.plot(lat, lng)
plt.scatter(lat[0], lng[0], c='r')
plt.scatter(lat[1:], lng[1:], c='b')
for i in range(len(lat)):
plt.text(lat[i], lng[i], str(i))
plt.show()