-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.py
More file actions
executable file
·36 lines (26 loc) · 877 Bytes
/
Copy pathplot.py
File metadata and controls
executable file
·36 lines (26 loc) · 877 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
#!/usr/bin/python3
import matplotlib.pyplot as plt
FILE = open("res.data", 'r')
data = FILE.readlines() # list of lines in FILE
mean = [] # list of successive means
percent_alive = []
percent_gem_eaten = []
for line in data:
temp = line.split(" ")
mean.append(float(temp[0]))
percent_alive.append(float(temp[1]))
percent_gem_eaten.append(float(temp[2]))
fig = plt.figure()
ax1 = fig.add_subplot(311)
plt.plot(range(len(mean)), mean)
plt.xlabel("Generation")
plt.ylabel("Mean strength\nof the selected")
ax2 = fig.add_subplot(312)
plt.plot(range(len(percent_alive)), percent_alive)
plt.xlabel("Generation")
plt.ylabel("Percentage of\nremaining alive bots")
ax3 = fig.add_subplot(313)
plt.plot(range(len(percent_gem_eaten)), percent_gem_eaten)
plt.xlabel("Generation")
plt.ylabel("Percentage of\neaten gems in the end")
plt.show()