-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.py
More file actions
56 lines (41 loc) · 1.38 KB
/
plot.py
File metadata and controls
56 lines (41 loc) · 1.38 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
import pickle
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
results=pickle.load(open("results.dmp","r"))
rnsga=results[(3, 'rNSGAII_solution', 'DTLZ1')]
asf=results[(3, 'ACH_solution', 'DTLZ1')]
c=['b','g','r','c','m','y','k']
for i,r in enumerate(asf[:len(c)]):
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
p=np.array(r[2][1])
ax.scatter(p[0,0],p[0,1],p[0,2], c=c[i], marker='D')
ax.scatter(p[-1,0],p[-1,1],p[-1,2], c=c[i], marker='x')
#ax.scatter(p[1:-1,0],p[1:-1,1],p[1:-1,2], c=c[i], marker='x')
ax.plot(p[:,0],p[:,1],p[:,2],c=c[i])
ax.scatter(r[0][0],r[0][1],r[0][2], c=c[i], marker='o')
ax.set_xlabel('f1')
ax.set_ylabel('f2')
ax.set_zlabel('f3')
fig.draw()
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
for i,r in enumerate(rnsga[:len(c)]):
p=np.array(r[2][0])
ax.scatter(p[:,0],p[:,1],p[:,2], c=c[i], marker='x')
ax.scatter(r[0][0],r[0][1],r[0][2], c=c[i], marker='o')
ax.set_xlabel('f1')
ax.set_ylabel('f2')
ax.set_zlabel('f3')
plt.show()
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
for i,r in enumerate(rnsga[:len(c)]):
p=np.array(r[2][1])
ax.scatter(p[:,0],p[:,1],p[:,2], c=c[i], marker='x')
ax.scatter(r[0][0],r[0][1],r[0][2], c=c[i], marker='o')
ax.set_xlabel('f1')
ax.set_ylabel('f2')
ax.set_zlabel('f3')
plt.show()