# Plotting boundary of 3d topographical plot on a 2D line

I have a table consisting of the points of the following plot:

Which looks like this from the top:

I would like to plot a line connecting all the dots of the boundary in the first picture, so that I have a 2d plot showing the the variation of height in the topograpghy. The code used for the generation of the plot is a little complicated so I do not want to post the whole code here. If I wanted to plot, say, the boundary of

Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}]


using a line, how would I be able to do this? The coordinates for this plot can be found on this link: https://dpaste.org/kORh Warning": This is quite a large file. Thanks for your help.

• "The code used for the generation of the plot is a little complicated so I do not want to post the whole code here." That's fine, post the values instead. I am afraid that the alternative example you propose may not be representative of your actual problem. Jan 12, 2020 at 19:03
• The data I have used is from actual surface topography of the skin and was processed using grid points. It's a really long table full of coordinates.@MarcoB should I still post it? Jan 12, 2020 at 19:09
• Yes, but since it's so long, it may be better to link to it. Since it's text only, use pastebin.com and then edit your question to add the link to the data. Jan 12, 2020 at 20:11
• I'm not sure what you mean by "boundary". Jan 12, 2020 at 20:13
• @ChrisK: By "boundary" , I mean a line connecting all the edge points on one face of the plot. For this example, it will be a sinusoidal-like plot due to the large degree of undulations at the surface. Jan 12, 2020 at 20:58

With elevation defined as your provided data, we can extract the points at the "boundary" / side with the minimum value of $$x$$:

flat = elevation~Flatten~1;

ListLinePlot[
With[{min = Min[flat[[All, 1]]]},
Cases[flat, {x_, y_, z_} /; x == min :> {y, z}]
],
Axes -> False, Frame -> True
]


Appropriate modifications to this code should give you any of the other three possibilities, i.e. max value of $$x$$, and min/max value of $$y$$.

• You are simply magnificent. Thank you so much! Jan 12, 2020 at 21:18
• @IfIcantdoit Glad I could help! Jan 12, 2020 at 21:37

Update

Plot the elevation for every tenth x slice (first plot is the same as @MarcoB's). The Part specification can be changed to slice along other axes.

elevation[[1 ;; ;; 10, All, 2 ;; 3]] //
Map[ListLinePlot[#, Axes -> False, Frame -> True] &] //
Partition[#, UpTo@7] & //
Grid


Not an answer, just some other ways of visualizing the data.

Neat, it does look like skin (using flat from @MarcoB's answer).

ListDensityPlot[flat, ColorFunction -> "GrayTones"]


ListContourPlot[flat]


• It is skin! My project is the effect of collagen fibres on the stress response of skin. Some interesting stuff. Thank you for your contribution - I have a presentation tomorrow to the head of continuum mechanics at university and this definitely shall help with the visualization of data. Jan 12, 2020 at 22:48