Plot a 3D surface from {x,y,z}-scatter data in python

前端 未结 1 538
一向
一向 2020-12-06 10:39

I\'m trying to plot a 3D surface constructed to fit some {x,y,z} points in python -- ideally something like the Mathematica ListSurfacePlot3D function. Thus far I\'ve tried

相关标签:
1条回答
  • 2020-12-06 11:00

    plot_surface expects X,Y,Z values in the form of 2D arrays, as would be returned by np.meshgrid. When the inputs are regularly gridded in this way, the plot function implicitly knows which vertices in the surface are adjacent to one another and therefore should be joined with edges. In your example, however, you're handing it 1D vectors of coordinates, so the plotting function would need to be able to figure out which vertices should be joined.

    The plot_trisurf function does handle irregularly spaced points by doing a Delaunay triangulation to determine which points should be joined with edges in such a way as to avoid 'thin triangles':

    enter image description here

    0 讨论(0)
提交回复
热议问题