def save(self, out_path):
'''Saves a figure for the monitor
Args:
out_path: str
'''
plt.clf()
np.set_printoptions(precision=4)
font = {
'size': 7
}
matplotlib.rc('font', **font)
y = 2
x = ((len(self.d) - 1) // y) + 1
fig, axes = plt.subplots(y, x)
fig.set_size_inches(20, 8)
for j, (k, v) in enumerate(self.d.iteritems()):
ax = axes[j // x, j % x]
ax.plot(v, label=k)
if k in self.d_valid.keys():
ax.plot(self.d_valid[k], label=k + '(valid)')
ax.set_title(k)
ax.legend()
plt.tight_layout()
plt.savefig(out_path, facecolor=(1, 1, 1))
plt.close()
评论列表
文章目录