说明:
接上一篇脚本中有个错误,一直未解决,其实是interpolate.interp2d的输入参数错误,输入参数应该一维数组,而不是二位数组。参考https://stackoverflow.com/questions/3526514/problem-with-2d-interpolation-in-scipy-non-rectangular-grid
所以在插值前,加两句把输入参数变成一维数组
XX = np.arange(0, 16, 1)
YY= np.arange(0, 12, 1)
代码:
from matplotlib import pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from scipy import interpolate
import matplotlib as mpl
import matplotlib.cm as cm
fig = plt.figure()
Z=np.empty([12,16])
#ax = Axes3D(fig)
ax = fig.add_subplot(121, projection='3d')
bx = fig.add_subplot(12