Skip to content

Commit 3085c5e

Browse files
committed
keep implementing
1 parent 4958eb6 commit 3085c5e

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

Mapping/kmean_clustering/kmean_clustering.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,35 @@
77
88
"""
99

10+
import matplotlib.pyplot as plt
11+
import random
12+
13+
14+
def calc_raw_data():
15+
16+
rx, ry = [], []
17+
18+
cx = [0.0, 5.0]
19+
cy = [0.0, 5.0]
20+
np = 30
21+
rand_d = 3.0
22+
23+
for (icx, icy) in zip(cx, cy):
24+
for _ in range(np):
25+
rx.append(icx + rand_d * (random.random() - 0.5))
26+
ry.append(icy + rand_d * (random.random() - 0.5))
27+
28+
return rx, ry
29+
1030

1131
def main():
1232
print(__file__ + " start!!")
1333

34+
rx, ry = calc_raw_data()
35+
36+
plt.plot(rx, ry, "x")
37+
plt.show()
38+
1439

1540
if __name__ == '__main__':
1641
main()

0 commit comments

Comments
 (0)