-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutils.py
47 lines (41 loc) · 960 Bytes
/
utils.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
import matplotlib.pyplot as plt
import numpy as np
def plot_mutil_lines_chart(
input,
legend_list=None,
max_line=np.inf,
save_name="test.png",
xlabel="",
ylabel="",
title=""
):
data = np.array(input)
data = data.T
plt.figure(figsize=(12, 6))
for y in data:
if max_line > 0:
x = range(y.size)
plt.plot(x, y)
max_line -= 1
if legend_list is not None:
plt.legend(legend_list)
plt.xlabel(xlabel)
plt.ylabel(ylabel)
plt.title(title)
plt.savefig(save_name)
plt.close()
# plt.show()
def plot_sum_lines_chart(data):
data = np.array(data)
y = np.sum(data, axis=-1)
plt.figure(figsize=(12, 6))
x = range(y.size)
plt.plot(x, y)
plt.show()
def plot_mean_lines_chart(data):
data = np.array(data)
y = np.mean(data, axis=-1)
plt.figure(figsize=(12, 6))
x = range(y.size)
plt.plot(x, y)
plt.show()