I have this XYZ text file (3 columns) and I'm trying to run an interpolation, so I can create a nice color model. The problem is that the returned result is not correctly representing the topography of my data distribution... I mean, the surface it is not as smooth as I want it to be. The bottom colors (red) are following the data (black dots), but the top colors (blue) are not. Any help?
import matplotlib.pyplot as plt
import scipy.interpolate
x,y,z = np.loadtxt("vel_model.txt",usecols=(0,1,2),unpack=True)
x_grid = np.linspace(x.min(),x.max(),100)
y_grid = np.linspace(y.min(),y.max(),100)
xi,yi = np.meshgrid(x_grid,y_grid)
zi = scipy.interpolate.griddata((x, y), z, (xi, yi), method = 'cubic')
fig = plt.figure()
ax = fig.add_subplot(111)
cm = ax.contourf(xi, yi, zi, cmap='jet')
ax.scatter(x,y,color='black',s = 6, label = 'Data points')
ax.set_aspect('equal')
ax.set_xlabel('Distance (m)')
ax.set_ylabel('Elevation (m)')
plt.legend(loc = 'best')
plt.grid(color='grey', linestyle='--', linewidth=0.3)
plt.show()```