我有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出來。我試圖轉換爲蒙面數組,但無濟於事 - 情節仍然是空白的。你能告訴我我做錯了什麼嗎?謝謝。