I have 3 1-D ndarrays: x, y, z
and the following code:
import numpy as np import matplotlib.pyplot as plt import scipy.interpolate as spinterp ## de
A slight improvement on the chosen answer
import numpy.ma as ma Zm = ma.masked_invalid(Z) plt.pcolormesh(X, Y, Zm.T)
masked_invalid masks all NaN values, thereby saving the need to specify
mask = np.isnan(Z)