# Plot a cut of a ListPlot3D

I have a bunch of points, e.g. minimal example:

x = {{0, 0, 1}, {1, 1, 0.5}, {-1, -1, 0.5}, {-1, 1, 0.5}, {1, -1,
0.5}}


and I am plotting them as a ListPlot3D:

ListPlot3D[x]


Giving me this:

--

What I would like is a 1D plot taken as a cut of this, like so:

The issue here being that there are no points at x = 0, so I'd have to take a projection on that plane? Or is there an interpolation method?

You can use Interpolation directly on your original data:

x = {{0, 0, 1}, {1, 1, 0.5}, {-1, -1, 0.5}, {-1, 1, 0.5}, {1, -1,  0.5}};
iF = Quiet @ Interpolation[x];

Row[{ListPlot3D[x, ImageSize -> 300, PlotLabel -> "ListPlot3D",
MeshFunctions -> {# &}, Mesh -> {{-.5, 0, .5}}, MeshStyle -> Thick],
Plot3D[iF[u, v], {u, -1, 1}, {v, -1, 1}, PlotPoints -> 100,
ImageSize -> 300, PlotLabel -> "Plot3D",
MeshFunctions -> {# &}, Mesh -> {{-.5, 0, .5}}, MeshStyle -> Thick]}]


Row[Plot[iF[#, t], {t, -1, 1}, ImageSize -> 220,
PlotRange -> {.5, 1}, PlotLabel -> Row[{"x = ", #}]] & /@ {-.5,  0, .5}]


• Hey thanks, but I cannot seem to be able to apply to my set of points, which is quite dense.. Jun 11, 2018 at 11:29
• @SuperCiocia, can you post an example of a small data set that shows the issue?
– kglr
Jun 11, 2018 at 11:41
• pastebin.com/3bvjKgzD Jun 11, 2018 at 11:57
• @SuperCiocia, the error message "Interpolation::indp: There are duplicated abscissa points in..." suggests that need to eliminate the duplicate abscissa (e.g., iF =Interpolation@DeleteDuplicates[data, #[[;; 2]] == #2[[;; 2]] &]) for Interpolation two work.
– kglr
Jun 11, 2018 at 12:33

You can interpolate

x = {{#, #2}, #3} & @@@ {
{0, 0, 1}, {1, 1, 0.5}, {-1, -1, 0.5}, {-1, 1, 0.5}, {1, -1, 0.5}
};

f = Interpolation[x];

Plot[f[0, y], {y, -1, 1}]