I have a set of data that comprises x and y coordinates and a calculated value for each coordinate. The grid is irregular so for now i have been creating a scatter plot and separating the values into bins to display as a contour as on the img at the link below. https://i.stack.imgur.com/m7XHm.png
I want to refine this method by using the imshow/contour functionality in matplotlib by using meshgrid and then interpolating the calculated values. I can get this to work fine but I end up with a problem that it loses the areas of the image with no data (voids in real life) and joins them up as shown on the image at the link below for the same data. https://i.stack.imgur.com/ZCRog.png
我试图找到这样做的最佳途径,但我没有发现这方面的任何帮助。 是否有任何人提出建议?
我认为,在网球阶段我需要修改这种方法,但我不相信这一点。 其价值如下:
x=nodalData[:,1] #array of x values from input file
y=nodalData[:,2] #array of y values from input file
#define the linear grid
xi, yi = np.linspace(x.min(), x.max(), 100), np.linspace(y.min(), y.max(), 100)
xi, yi = np.meshgrid(xi, yi)
z=Rres #array calculated elsewhere corresponding to x,y pair
#interpolate
zi = scipy.interpolate.griddata((x, y), z, (xi, yi), method= cubic )
#plot
plt.imshow(zi, vmin=z.min(), vmax=z.max(), origin= lower , extent=[x.min(), x.max(), y.min(), y.max()])