PINN discover代码学习 作图部分
PINNs-master\appendix\continuous_time_identification (Burgers)
fig, ax = newfig(1.0, 1.4)
ax.axis('off')
ax = fig.add_subplot(111) # ax = fig.add_subplot(1, 1, 1)
gs0 = gridspec.GridSpec(1, 2) # 将画布分割,一行二列
gs0.update(top=1-0.06, bottom=1-1.0/3.0+0.06, left=0.15, right=0.85, wspace=0)
ax = plt.subplot(gs0[:, :]) #规定作图区域
imshow()
部分参数
h = ax.imshow(X, interpolation='nearest', cmap='rainbow',
extent=[t.min(), t.max(), x.min(), x.max()],
origin='lower', aspect='auto')
- X: 数据 shape(M, N)
- interpolation:
nearest
,把某块显示成一种颜色,不是渐变的那种 - cmap: 用于设置热图的Colormap,不同选项图中颜色不同
- extent: 控制坐标轴
- origin:
-
lower
: 数据左下(0, 0),右上(M, N) -
upper
: 数据左上(0, 0),右下(M, N)
-
- aspect: 待解决
from scipy.interpolate import griddata
多维插值,常用于重构图片
griddata(points, values, xi, method='linear', fill_value=nan)
- points: K维空间中的坐标,它可以是形状为(N,k)的数组,也可以是一个有k个数组的序列。
- values: points中每个点对应的值。
- xi: 需要插值的坐标
- method:
-
nearest
, 0阶插值 -
linear
, 1阶插值 -
cubic
, 3阶插值
-
网友评论