# Interpolating and plotting a surface for a sparse set of 3d data points

I have a set of $(x,y,z)$ coordinates which sparsely cover a surface, e.g.:

data = {{51, 15, 0.1}, {300, 11, 0.99}, {140, 22, 0.123}, {54, 12, 0.66}, ...};


What is a good general method, in Mathematica 9, of interpolating and plotting a surface for this sparse data set? Graphics3D[BSplineSurface[data]] doesn't seem to get the job done; the output is a planar rectangle.

• Have you tried ListPlot3D? – m_goldberg Jun 18 '13 at 5:57
• Interpolation works for multidimensional functions but You have to be sure that there are no duplicates in {x,y} with different z. Interpolation[{{#1, #2}, #3} & @@@ data] – Kuba Jun 18 '13 at 6:07
• You might want to look into thin plate splines... – J. M. is in limbo Jun 18 '13 at 6:18
• @m_goldberg ListPlot3D seems to do what I'd like, so thanks! But do you know what interpolation method is being used? – InsM Jun 18 '13 at 6:29

You can use the option InterpolationOrder to control the degree of smoothing.

SeedRandom; data = RandomReal[10, {20, 3}];
Column[
ListPlot3D[data,
ImageSize -> Medium,
Mesh -> None,
InterpolationOrder -> #] & /@ Range[0, 2]] • Setting InterpolationOrder greater than 1 doesn't seem to make a difference unless you have regular data (sampled on a grid)... – Rahul Jun 18 '13 at 7:37

I'd go with ListPointPlot3D.

ListPoint3D generates a 3D scattered plot of points with coordinates {xi,yi,zi}.

Since you're a bit avaricious with your data, here the plot with your data:

data = {{51, 15, 0.1}, {300, 11, 0.99}, {140, 22, 0.123}, {54, 12, 0.66}};
ListPointPlot3D[data, PlotStyle -> PointSize[0.03], Filling -> Bottom,
ViewPoint -> {0, 0, \[Infinity]}] Edit:

If you want to use BSpline, just take a BSplineCurve, if your data does not produce a decent surface:

Graphics3D[{BSplineCurve[data], PointSize[Medium], Green, Line[data],
Red, Point[data]}, BoxRatios -> {2, 2, 2}] Edit2:

For a BSplineSurface (with qualified data) you can do something like:

data=Table[{i, j, RandomReal[{-1, 1}]}, {i, 3}, {j, 3}];
Show[Graphics3D[{PointSize[Medium], Red, Map[Point, data], Gray,
Line[data], Line[Transpose[data]]}], Graphics3D[BSplineSurface[data]]] • Thanks, but I'm specifically looking for a surface! – InsM Jun 18 '13 at 6:33
• so why not pasting your data completely? – Stefan Jun 18 '13 at 6:49