import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif']=['SimHei'] #显示中文标签
plt.rcParams['axes.unicode_minus']=True #这两行需要手动设置
with plt.style.context(['science']):
fig , ax = plt.subplots(figsize=(4,2))
ax.plot(train_loss_list,label = 'Train loss')
#ax.autoscale(tight = True)
ax.legend()
ax.set_xlabel('Epoch')
ax.set_ylabel('Loss')
fig.savefig('trainloss.jpg',dpi = 300)