3
$\begingroup$

I have a table consisting of the points of the following plot: enter image description here

Which looks like this from the top: enter image description here

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.

$\endgroup$
5
  • 2
    $\begingroup$ "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. $\endgroup$
    – MarcoB
    Jan 12, 2020 at 19:03
  • $\begingroup$ 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? $\endgroup$ Jan 12, 2020 at 19:09
  • $\begingroup$ 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. $\endgroup$
    – MarcoB
    Jan 12, 2020 at 20:11
  • $\begingroup$ I'm not sure what you mean by "boundary". $\endgroup$
    – Chris K
    Jan 12, 2020 at 20:13
  • $\begingroup$ @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. $\endgroup$ Jan 12, 2020 at 20:58

2 Answers 2

4
$\begingroup$

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
]

boundary corresponding to the min values of x

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$.

$\endgroup$
2
  • $\begingroup$ You are simply magnificent. Thank you so much! $\endgroup$ Jan 12, 2020 at 21:18
  • $\begingroup$ @IfIcantdoit Glad I could help! $\endgroup$
    – MarcoB
    Jan 12, 2020 at 21:37
5
$\begingroup$

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

enter image description here


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"]

enter image description here

ListContourPlot[flat]

enter image description here

$\endgroup$
1
  • $\begingroup$ 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. $\endgroup$ Jan 12, 2020 at 22:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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