I am trying to generate contour maps using irregular data after gridding the data in python. I am getting something like the image on left while I am trying to get a contour plot like the one on the right side without any white spaces in my plot (unplotted space ?)
I am initially creating a grid using the below code
def grid(x, y, z, resX=100, resY=100):
xi = linspace(min(x), max(x), resX)
yi = linspace(min(y), max(y), resY)
Z = griddata(x, y, z, xi, yi, interp='linear')
X, Y = meshgrid(xi, yi)
return X, Y, Z
X, Y, Z = grid(x, y, z)
contour = plt.contourf(X,Y,Z)
Where x,y,z are columns from my csv file.
I tried using other methods like using matplotlib.pyplot.tricontourf but the plot looks similar to the one I am getting.
Rbf from scipy.interpolate.rbf gives a plot similar to the one on right side if I use a subset of my data but it doesn't work for large datasets.


griddatadocs; and theZvalues. I suspect the white spaces arenanvalues, for grid points outside thehullof the data. That is, where it would have to extrapolate.contourkeyword values?plt.contourfbefore switching toplt.tricontourfas this does not require me to explicitly grid the data. The results are similar forcontourfandtricontourf