-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript.py
More file actions
43 lines (28 loc) · 1012 Bytes
/
Copy pathscript.py
File metadata and controls
43 lines (28 loc) · 1012 Bytes
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
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
file_name = 'pareto_final.txt'
f = open(file_name, 'r',encoding='utf-8')
data = [i.split(']')[0].replace('[','').replace(',','').split() for i in f.readlines()]
data = [(float(i[0]),float(i[1]),float(i[2])) for i in data]
data = pd.DataFrame(data=data).drop_duplicates()
print(data)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
x =data[0].tolist()
y =data[1].tolist()
z =data[2].tolist()
ax.scatter(x, y, z, c='r', marker='o')
file_name = 'initial_population.txt'
f = open(file_name, 'r',encoding='utf-8')
data = [i.split(']')[0].replace('[','').replace(',','').split() for i in f.readlines()]
data = [(float(i[0]),float(i[1]),float(i[2])) for i in data]
data = pd.DataFrame(data=data).drop_duplicates()
x =data[0].tolist()
y =data[1].tolist()
z =data[2].tolist()
ax.scatter(x, y, z, c='b', marker='v')
ax.set_xlabel('X Label')
ax.set_ylabel('Y Label')
ax.set_zlabel('Z Label')
plt.show()