-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgraph.py
More file actions
100 lines (81 loc) · 2.79 KB
/
graph.py
File metadata and controls
100 lines (81 loc) · 2.79 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
def plot_graph(x_value, y_values, legend_names, x_axis_title, y_axis_title, filename_to_save, plot_points = None, saveFigures=True,plot_graph_=False):
import matplotlib.pyplot as plt
fig = plt.figure(1)
ax = fig.add_subplot(1,1,1)
if(plot_points):
for i in range(len(y_values)):
ax.plot(x_value,
y_values[i],
plot_points[i],
label = legend_names[i])
else:
for i in range(len(y_values)):
ax.plot(x_value,
y_values[i],
label = legend_names[i])
ax.set_xlabel (x_axis_title)
ax.set_ylabel (y_axis_title)
plt.legend(loc = 'upper left')
if(saveFigures):
plt.savefig(filename_to_save)
if (plot_graph_):
plt.show()
plt.clf()
return
def plot_graph2(x_value, y_values, legend_names, x_axis_title, y_axis_title, filename_to_save, saveFigures=True,plot_graph_=False):
import matplotlib.pyplot as plt
import numpy as np
y_std = np.std(y_values, axis=1)
y_mean = np.mean(y_values, axis=1)
fig = plt.figure(1)
ax = fig.add_subplot(1,1,1)
#for i in range(len(y_values)):
ax.plot(x_value,
y_mean,
label = legend_names)#[:,i],
#label = legend_names[i])
ax.fill_between(x_value,
(y_mean - y_std),
(y_mean + y_std),
alpha=0.2)
ax.set_xlabel (x_axis_title)
ax.set_ylabel (y_axis_title)
plt.legend(loc = 'upper left')
if(saveFigures):
plt.savefig(filename_to_save)
if (plot_graph_):
plt.show()
plt.clf()
return
def plot_graph3(x_value, y_values, legend_names, x_axis_title, y_axis_title, filename_to_save, saveFigures=True,plot_graph_=False):
import matplotlib.pyplot as plt
import numpy as np
y_std = np.std(y_values[0], axis=1)
y_mean = np.mean(y_values[0], axis=1)
fig = plt.figure(1)
ax = fig.add_subplot(1,1,1)
#for i in range(len(y_values)):
ax.plot(x_value,
y_mean,
label = legend_names[0],
color='b')#[:,i],
#label = legend_names[i])
ax.fill_between(x_value,
(y_mean - y_std),
(y_mean + y_std),
alpha=0.2)
ax.set_xlabel (x_axis_title)
ax.set_ylabel (y_axis_title)
ax.plot(x_value,
y_values[1],
label = legend_names[1],
color='r')#[:,i],
#label = legend_names[i])
ax.set_ylim([7,22])
plt.legend(loc = 'upper left')
if(saveFigures):
plt.savefig(filename_to_save)
if (plot_graph_):
plt.show()
plt.clf()
return