Home > other >  strange plot surface of matplotlib
strange plot surface of matplotlib

Time:05-17

I'm trying to generate a 3D height figure, I have a regular grid, the height data collected by the sensor and data store in a file which name is "data.txt". data stored one data per line. the enter image description here

CodePudding user response:

I think you need scipy.griddata. Try this code:

from scipy.interpolate import griddata
za = griddata(x, y, z, (xx, yy), method='linear')
surf=ax.plot_surface(xx,yy,za,cmap="summer",linewidth=0,antialiased=False, alpha=0.5)
fig.colorbar(surf)
plt.show()
  • Related