我有3个1-d ndarrays:X,Y,Zpcolormesh缺失值?
和以下代码:
import numpy as np
import matplotlib.pyplot as plt
import scipy.interpolate as spinterp
## define data
npoints = 50
xreg = np.linspace(x.min(),x.max(),npoints)
yreg = np.linspace(y.min(),y.max(),npoints)
X,Y = np.meshgrid(xreg,yreg)
Z = spinterp.griddata(np.vstack((x,y)).T,z,(X,Y),
method='linear').reshape(X.shape)
## plot
plt.close()
ax = plt.axes()
col = ax.pcolormesh(X,Y,Z.T)
plt.draw()
我的情节出来空白,我怀疑这是因为该方法= '线性' 内插与nans出来。我试图转换为蒙面数组,但无济于事 - 情节仍然是空白的。你能告诉我我做错了什么吗?谢谢。