forked from Ceruleanacg/Personae
-
Notifications
You must be signed in to change notification settings - Fork 0
/
data_ploter.py
28 lines (23 loc) · 869 Bytes
/
data_ploter.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
# coding=utf-8
import matplotlib.pyplot as plt
import math
def plot_stock_series(codes, y, label, save_path, y_desc='Predict', label_desc='Real'):
row, col = int(math.ceil(len(codes) / 2)), int(math.ceil(len(codes) / 2))
plt.figure(figsize=(40, 25))
for index, code in enumerate(codes):
plt.subplot(row * 100 + col * 10 + (index + 1))
plt.title(code)
plt.plot(y[:, index], label=y_desc)
plt.plot(label[:, index], label=label_desc)
plt.legend(loc='upper left')
# plt.show()
plt.savefig(save_path, dpi=200)
def plot_profits_series(base, profits, save_path):
plt.figure(figsize=(20, 15))
plt.subplot(111)
plt.title("Profits - Baseline")
plt.plot(base, label='base')
plt.plot(profits, label='profits')
plt.legend(loc='upper left')
# plt.show()
plt.savefig(save_path, dpi=200)