-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprettyplot.py
55 lines (41 loc) · 1.8 KB
/
prettyplot.py
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
# create the plots using the data created in plotting.py
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
sns.set(font_scale=1.65)
plt.figure(figsize=(8, 6))
enemy = 3
df = pd.read_csv("rank" + str(enemy) + ".csv")
plt.title("Fitness progression versus enemy {}".format(enemy))
alpha = 0.2
g = np.linspace(0, 49, 50)
sns.lineplot(x = g, y = "max", data = df, color = "blue", label="EA2 max")
yp = df["max"] - df["maxstd"]
sns.lineplot(x = g, y = yp, data = df, color='blue', alpha = alpha)
ym = df["max"] + df["maxstd"]
sns.lineplot(x = g, y = ym, data = df, color='blue', alpha = alpha)
plt.fill_between(g, yp, ym, color = 'blue', alpha = alpha)
sns.lineplot(x = g, y = "mean", data = df, color = "green", label="EA2 mean")
yp = df["mean"] - df["meanstd"]
sns.lineplot(x = g, y = yp, data = df, color='green', alpha = alpha)
ym = df["mean"] + df["meanstd"]
sns.lineplot(x = g, y = ym, data = df, color='green', alpha = alpha)
plt.fill_between(g, yp, ym, color = 'green', alpha = alpha)
df = pd.read_csv("tour" + str(enemy) + ".csv")
sns.lineplot(x = g, y = "max", data = df, color = "red", label="EA1 max")
yp = df["max"] - df["maxstd"]
sns.lineplot(x = g, y = yp, data = df, color='red', alpha = alpha)
ym = df["max"] + df["maxstd"]
sns.lineplot(x = g, y = ym, data = df, color='red', alpha = alpha)
plt.fill_between(g, yp, ym, color = 'red', alpha = alpha)
sns.lineplot(x = g, y = "mean", data = df, color = "orange", label="EA1 mean")
yp = df["mean"] - df["meanstd"]
sns.lineplot(x = g, y = yp, data = df, color='orange', alpha = alpha)
ym = df["mean"] + df["meanstd"]
sns.lineplot(x = g, y = ym, data = df, color='orange', alpha = alpha)
plt.fill_between(g, yp, ym, color = 'orange', alpha = alpha)
plt.ylabel("Fitness [-]")
plt.xlabel("Generation [-]")
plt.legend()
plt.show()