Skip to main content
deleted 38 characters in body; edited title
Source Link

Extracting Points points from 3DPlot MeshFunctionthe MeshFunctions of Plot3D

I am trying to extract the points from the mesh lines of a 3D plot. (Not my actual function.)

   p = Plot3D[Sin[x]^2*Cos[y], {x, -1, 1}, {y, -1, 1},  MeshFunctions -> {#1^2+#2^2 &}]

![enter image description here][1]my plot

I found a similar question here. So I used the code suggested.:

p2 = p // Cases[#, GraphicsComplex[Line_, ___] :> Line] &;  
p3 = Flatten[p2, 1];  
ListPlot[p3[[All, 1 ;; 2]]]  

![enter image description here][2]
[1]: https://i.sstatic.net/HH4pD.jpg
[2]: https://i.sstatic.net/iHVYu.jpgmy attempt at extracting mesh lines

As you can see, I am getting a bunch of points that are not on the mesh lines. When I increase the PlotPointsPlotPoints, it gets even worse.

How can I extract only the points on the mesh lines?

Extracting Points points from 3DPlot MeshFunction

I am trying to extract the points from the mesh lines of a 3D plot. (Not my actual function.)

   p = Plot3D[Sin[x]^2*Cos[y], {x, -1, 1}, {y, -1, 1},  MeshFunctions -> {#1^2+#2^2 &}]

![enter image description here][1]

I found a similar question here. So I used the code suggested.

p2 = p // Cases[#, GraphicsComplex[Line_, ___] :> Line] &;  
p3 = Flatten[p2, 1];  
ListPlot[p3[[All, 1 ;; 2]]]  

![enter image description here][2]
[1]: https://i.sstatic.net/HH4pD.jpg
[2]: https://i.sstatic.net/iHVYu.jpg

As you can see, I am getting a bunch of points that are not on the mesh lines. When I increase the PlotPoints, it gets even worse.

How can I extract only the points on the mesh lines?

Extracting points from the MeshFunctions of Plot3D

I am trying to extract the points from the mesh lines of a 3D plot. (Not my actual function.)

   p = Plot3D[Sin[x]^2*Cos[y], {x, -1, 1}, {y, -1, 1},  MeshFunctions -> {#1^2+#2^2 &}]

my plot

I found a similar question here. So I used the code suggested:

p2 = p // Cases[#, GraphicsComplex[Line_, ___] :> Line] &;  
p3 = Flatten[p2, 1];  
ListPlot[p3[[All, 1 ;; 2]]]  

my attempt at extracting mesh lines

As you can see, I am getting a bunch of points that are not on the mesh lines. When I increase the PlotPoints, it gets even worse.

How can I extract only the points on the mesh lines?

added 11 characters in body
Source Link
Dr. belisarius
  • 116.2k
  • 13
  • 205
  • 456

I am trying to extract the points from the mesh lines of a 3D plot. (Not my actual function.)

p = Plot3D[Sin[x]^2*Cos[y], {x, -1, 1}, {y, -1, 1}, MeshFunctions -> {#1^2+#2^2 &}]

   p = Plot3D[Sin[x]^2*Cos[y], {x, -1, 1}, {y, -1, 1},  MeshFunctions -> {#1^2+#2^2 &}]

![enter image description here][1]

I found a similar question here. So I used the code suggested.

p2 = p // Cases[#, GraphicsComplex[Line_, ___] :> Line] &;
p3 = Flatten[p2, 1];
ListPlot[p3[[All, 1 ;; 2]]]

p2 = p // Cases[#, GraphicsComplex[Line_, ___] :> Line] &;  
p3 = Flatten[p2, 1];  
ListPlot[p3[[All, 1 ;; 2]]]  

![enter image description here][2]
[1]: https://i.sstatic.net/HH4pD.jpg
[2]: https://i.sstatic.net/iHVYu.jpg

As you can see, I am getting a bunch of points that are not on the mesh lines. When I increase the PlotPoints, it gets even worse.

How can I extract only the points on the mesh lines?

I am trying to extract the points from the mesh lines of a 3D plot. (Not my actual function.)

p = Plot3D[Sin[x]^2*Cos[y], {x, -1, 1}, {y, -1, 1}, MeshFunctions -> {#1^2+#2^2 &}]

![enter image description here][1]

I found a similar question here. So I used the code suggested.

p2 = p // Cases[#, GraphicsComplex[Line_, ___] :> Line] &;
p3 = Flatten[p2, 1];
ListPlot[p3[[All, 1 ;; 2]]]

![enter image description here][2]
[1]: https://i.sstatic.net/HH4pD.jpg
[2]: https://i.sstatic.net/iHVYu.jpg

As you can see, I am getting a bunch of points that are not on the mesh lines. When I increase the PlotPoints, it gets even worse.

How can I extract only the points on the mesh lines?

I am trying to extract the points from the mesh lines of a 3D plot. (Not my actual function.)

   p = Plot3D[Sin[x]^2*Cos[y], {x, -1, 1}, {y, -1, 1},  MeshFunctions -> {#1^2+#2^2 &}]

![enter image description here][1]

I found a similar question here. So I used the code suggested.

p2 = p // Cases[#, GraphicsComplex[Line_, ___] :> Line] &;  
p3 = Flatten[p2, 1];  
ListPlot[p3[[All, 1 ;; 2]]]  

![enter image description here][2]
[1]: https://i.sstatic.net/HH4pD.jpg
[2]: https://i.sstatic.net/iHVYu.jpg

As you can see, I am getting a bunch of points that are not on the mesh lines. When I increase the PlotPoints, it gets even worse.

How can I extract only the points on the mesh lines?

Source Link

Extracting Points points from 3DPlot MeshFunction

I am trying to extract the points from the mesh lines of a 3D plot. (Not my actual function.)

p = Plot3D[Sin[x]^2*Cos[y], {x, -1, 1}, {y, -1, 1}, MeshFunctions -> {#1^2+#2^2 &}]

![enter image description here][1]

I found a similar question here. So I used the code suggested.

p2 = p // Cases[#, GraphicsComplex[Line_, ___] :> Line] &;
p3 = Flatten[p2, 1];
ListPlot[p3[[All, 1 ;; 2]]]

![enter image description here][2]
[1]: https://i.sstatic.net/HH4pD.jpg
[2]: https://i.sstatic.net/iHVYu.jpg

As you can see, I am getting a bunch of points that are not on the mesh lines. When I increase the PlotPoints, it gets even worse.

How can I extract only the points on the mesh lines?