画图
画图尺寸
plt.xlim(1,2)
plt.legend(loc = 'upper right')
图中图
参考
axins = ax[0].inset_axes((2 / 3, 6 / 17, 0.3, 0.3))
axins.plot(lambda_PINN_0 * (1e3), '-', label='PINN with $a =1$'
, color='b', lw=1.2,zorder=10)
axins.plot(lambda_PINN * (1e3), label='PINN with variable a',
color ='g', linestyle='--', lw=1.2,zorder=20)
axins.plot(lambda_RPINN * (1e3), '-.', label='NRPINN with variable a'
, color='r', lw=1.2)
axins.axhline(y=(1e3) * 0.01 / pi, color='black', linestyle='--', label='Exact', lw=1)
axins.set_xticks([40000, 50000, 60000])
axins.set_xlim(40000, 60000)
axins.set_ylim(3, 4)
线条调整
ax[1].plot(loss_RPINN, '-.', label='NRPINN with variable a',
color= 'r', lw=1.2,alpha=1)
handles,labels=ax[1].get_legend_handles_labels()
ax[1].legend(handles[::-1],labels[::-1],loc='best')
font1 = {
# 'family': 'Times New Roman',
'weight': 'normal',
'size': 10,
}
plt.legend(('PDE loss', 'BC loss', 'Pred loss'), loc='upper right', prop=font1)
保存矢量图
plt.savefig('./result_plot/nu_adapt.png', bbox_inches='tight', dpi=600, format='png',
pad_inches=0.1)
fig.tight_layout()
plt.subplots_adjust(wspace=0.05, hspace=0.1)
设置colorbar范围
img = plt.imshow(out, cmap='jet')
cbar = plt.colorbar(img, pad=5, extend='both')
cbar.mappable.set_clim(298, 335)