3
$\begingroup$

I have a list called "b" and when I use ListPlot3D function to get the surface of the list; the surface's edge is closed as you see in the figüre but I don't want the edge to be closed like that. What could I do to solve this problem ?

b={{-0.734936,0.676489,1.00187},{-0.870847,0.828611,0.937642},{-1.01044,0.981459,0.994289},{-1.15373,1.13504,1.08527},{-1.3007,1.28934,1.1864},{-1.45137,1.44437,1.28758},{-0.683079,0.731911,1.36736},{-0.789785,0.91049,1.14136},{-0.904453,1.08576,1.12626},{-1.02708,1.25771,1.18277},{-1.15768,1.42636,1.26898},{-1.29623,1.59169,1.36762},{-0.626413,0.782206,1.73348},{-0.707384,0.982853,1.35911},{-0.799561,1.17684,1.26175},{-0.902943,1.36418,1.27309},{-1.01753,1.54486,1.33582},{-1.14332,1.71889,1.42502},{-0.564939,0.827374,2.05975},{-0.623646,1.0457,1.57316},{-0.695768,1.25472,1.39287},{-0.781307,1.45444,1.3522},{-0.880262,1.64486,1.38479},{-0.992632,1.82597,1.45918},{-0.498657,0.867415,2.32624},{-0.538569,1.09903,1.76808},{-0.593075,1.31939,1.5114},{-0.662176,1.52849,1.41559},{-0.745873,1.72634,1.41346},{-0.844164,1.91293,1.46927},{-0.427568,0.902329,2.52971},{-0.452153,1.14285,1.93258},{-0.491481,1.37085,1.60938},{-0.545551,1.58634,1.45837},{-0.614363,1.78931,1.41924},{-0.697917,1.97977,1.45482},{-0.35167,0.932117,2.67594},{-0.364399,1.17714,2.05958},{-0.390986,1.4091,1.67941},{-0.43143,1.62797,1.47539},{-0.485732,1.83377,1.39974},{-0.553891,2.0265,1.41652},{-0.270964,0.956778,2.77363},{-0.275307,1.20193,2.14511},{-0.29159,1.43413,1.71458},{-0.319815,1.6534,1.46128},{-0.35998,1.85972,1.35333},{-0.412086,2.0531,1.35752},{-0.185451,0.976312,2.83084},{-0.184876,1.21719,2.18647},{-0.193294,1.44596,1.70786},{-0.210705,1.66262,1.41058},{-0.237108,1.86716,1.27994},{-0.272503,2.05959,1.28477},{-0.0951294,0.990719,2.85322},{-0.0931073,1.22295,2.18006},{-0.0960975,1.44458,1.65093},{-0.1041,1.65563,1.31764},{-0.117114,1.85609,1.18199},{-0.135141,2.04596,1.20983},{4.44089*10^-16,1.,2.84303},{4.44089*10^-16,1.21918,2.11871},{4.44089*10^-16,1.42999,1.53214},{4.44089*10^-16,1.63243,1.17654},{4.44089*10^-16,1.8265,1.06519},{4.44089*10^-16,2.0122,1.14791}};

enter image description here

$\endgroup$
  • $\begingroup$ What do you mean by closed? Did you try to rotate the image to see? I do not see it closed at all. Look below it? $\endgroup$ – Nasser Jan 15 '17 at 13:11
  • $\begingroup$ @Nasser How could I remove the pink one ? $\endgroup$ – user45055 Jan 15 '17 at 17:18
7
$\begingroup$

It's not all that easy to do. The problem is that ListPlot3D doesn't like to follow a concave edge.

b =
  {{-0.734936,0.676489,1.00187}
   {-0.870847,0.828611,0.937642}
   {-1.01044,0.981459,0.994289}
   {-1.15373,1.13504,1.08527}
   {-1.3007,1.28934,1.1864}
   {-1.45137,1.44437,1.28758}
   {-0.683079,0.731911,1.36736}
   {-0.789785,0.91049,1.14136}
   {-0.904453,1.08576,1.12626}
   {-1.02708,1.25771,1.18277}
   {-1.15768,1.42636,1.26898}
   {-1.29623,1.59169,1.36762}
   {-0.626413,0.782206,1.73348}
   {-0.707384,0.982853,1.35911}
   {-0.799561,1.17684,1.26175}
   {-0.902943,1.36418,1.27309}
   {-1.01753,1.54486,1.33582}
   {-1.14332,1.71889,1.42502}
   {-0.564939,0.827374,2.05975}
   {-0.623646,1.0457,1.57316}
   {-0.695768,1.25472,1.39287}
   {-0.781307,1.45444,1.3522}
   {-0.880262,1.64486,1.38479}
   {-0.992632,1.82597,1.45918}
   {-0.498657,0.867415,2.32624}
   {-0.538569,1.09903,1.76808}
   {-0.593075,1.31939,1.5114}
   {-0.662176,1.52849,1.41559}
   {-0.745873,1.72634,1.41346}
   {-0.844164,1.91293,1.46927}
   {-0.427568,0.902329,2.52971}
   {-0.452153,1.14285,1.93258}
   {-0.491481,1.37085,1.60938}
   {-0.545551,1.58634,1.45837}
   {-0.614363,1.78931,1.41924}
   {-0.697917,1.97977,1.45482}
   {-0.35167,0.932117,2.67594}
   {-0.364399,1.17714,2.05958}
   {-0.390986,1.4091,1.67941}
   {-0.43143,1.62797,1.47539}
   {-0.485732,1.83377,1.39974}
   {-0.553891,2.0265,1.41652}
   {-0.270964,0.956778,2.77363}
   {-0.275307,1.20193,2.14511}
   {-0.29159,1.43413,1.71458}
   {-0.319815,1.6534,1.46128}
   {-0.35998,1.85972,1.35333}
   {-0.412086,2.0531,1.35752}
   {-0.185451,0.976312,2.83084}
   {-0.184876,1.21719,2.18647}
   {-0.193294,1.44596,1.70786}
   {-0.210705,1.66262,1.41058}
   {-0.237108,1.86716,1.27994}
   {-0.272503,2.05959,1.28477}
   {-0.0951294,0.990719,2.85322}
   {-0.0931073,1.22295,2.18006}
   {-0.0960975,1.44458,1.65093}
   {-0.1041,1.65563,1.31764}
   {-0.117114,1.85609,1.18199}
   {-0.135141,2.04596,1.20983}
   {4.44089*10^-16,1.,2.84303}
   {4.44089*10^-16,1.21918,2.11871}
   {4.44089*10^-16,1.42999,1.53214}
   {4.44089*10^-16,1.63243,1.17654}
   {4.44089*10^-16,1.8265,1.06519}
   {4.44089*10^-16,2.0122,1.14791}};

First lets project your data onto the xy-plane.

Graphics[Point[b[[All, 1 ;; 2]]]]

pts

This clearly shows a concave edge along the bottom the plot. To get Mathematica to follow this edge in 3D, we will restrict it the region made by fitting poly-lines to the outermost points in the array shown above.

It is useful to break the array into six rows of 11 points each. This makes it easier to extract the points we need for the poly-lines.

 b2D = Partition[b[[All, 1 ;; 2]], 6];

Here are the expression the make the poly-lines:

b2Dlf = Line[First[b2D]];
b2Drt = Line[Last[b2D]];
b2Dbtm = 
  Line[
    With[{f = Interpolation[First /@ b2D]},
      With[{d = First@f["Domain"]}, 
        Table[{x, f[x]}, {x, Subdivide[Sequence @@ d, 23]}]]]];
b2Dtop = Line[Last /@ b2D];

b2Dbtm is complicated because it is the concave edge where we need to supply more information to Mathematica.

Now we make a region out of the poly-lines.

r = BoundaryDiscretizeGraphics[Graphics[{b2Dlf, b2Drt, b2Dbtm, b2Dtop}]]

region

Finally, we use the region to restrict the plot and we also tell Mathematica to plot at a higher resolution than the default setting.

ListPlot3D[b,
  MaxPlotPoints -> 100,
  RegionFunction -> Function[{x, y, z}, {x, y} ∈ r]]

surface

top

$\endgroup$
  • $\begingroup$ Thank you very much @m_goldberg. You are great. $\endgroup$ – user45055 Jan 16 '17 at 8:13
  • $\begingroup$ I have a problem that has a warning it says Table::iterb: "Iterator {x,Subdivide[-0.734936,4.44089*10^-16,23]} does not have appropriate bounds" @m_goldberg $\endgroup$ – user45055 Jan 16 '17 at 13:02
  • $\begingroup$ @user45055. What version of Mathematica are you using? The code that appears in my answer requires Version 10.1 or later. $\endgroup$ – m_goldberg Jan 16 '17 at 18:08

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.