1
$\begingroup$

I am trying to plot a surface plot, but the surface plot is empty. It does show the frame of the plot if I plot with ListPointPlot3D, but not with ListSurfacePlot3D.

How can I make this data into a surface plot?

v = Table[Table[{xgrid[[i]], xgrid[[j]], u[[i*j]]}, {i, 1,Length[xgrid]}], {j, 1, Length[xgrid]}];

ListPointPlot3D[v, ViewPoint -> {0, -2, 0}] /. Point -> Line
ListSurfacePlot3D[v, PlotRange -> All]
ListPlot3D[v, Mesh -> All]

Here is ListPointPlot3D: ListPointPlot3D

Here is ListSurfacePlot3D: ListSurfacePlot3D

$\endgroup$
  • 1
    $\begingroup$ Try ListSurfacePlot3D[ Flatten[v, 1] ] $\endgroup$ – Jason B. Apr 9 at 20:32
1
$\begingroup$

The structure of your table is wrong. Look at the nesting of the lists. For ListPlot3D or ListSurfacePlot3D, you need v to be of the form {{x1,y1,z1},{x2,y2,z2},...}.

Try

v2=Partition[Flatten[v],3]

and then do ListPlot3D or ListSurfacePlot3D on v2.

$\endgroup$
  • $\begingroup$ Or just Flatten[v, 1] $\endgroup$ – b3m2a1 Apr 9 at 23:33
  • $\begingroup$ Thanks! I should have looked! $\endgroup$ – Frank Apr 10 at 0:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.