1
$\begingroup$

I would like to know if there is a way to extract x,y,z points from ParametricPlot3D.

>

ParametricPlot3D[{a1, b1, c1, d1, f1, g1, h1, i1, j1}, {t, 3, 4}, {w, 0, 2 [Pi]}, Axes -> True, AxesStyle -> {Red, Green, Blue},
AxesStyle -> {Red, Green, Blue}, PlotStyle -> {Red, LightPink}, Mesh -> None]

ParametricPlot3D[{a1, b1, c1, d1, f1, g1, h1, i1, j1}, {t, 3, 4}, {w, 0, 2 [Pi]}, Axes -> False, Boxed -> False, PlotStyle -> {Red, LightPink}, Mesh -> None]

a

$\endgroup$
1
  • $\begingroup$ Welcome to Mathematica.SE, NurFadhilah! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – Chris K
    Apr 23, 2019 at 9:30

1 Answer 1

4
$\begingroup$

We have, for example:

plot1 = ParametricPlot3D[{Cos[u], Sin[u] + Cos[v], Sin[v]}, {u, 0, 2 \[Pi]}, {v, -\[Pi], \[Pi]}]

enter image description here

Then we can extract the points using the following:

pts=Flatten[Cases[plot1, _GraphicsComplex , Infinity][[;; , 1]], 1]

We can then superimpose them on an already existing plot:

Show[plot1, Graphics3D[Point[pts]]]

enter image description here

Or we can save them as a .txt document, in the form of a table:

Export["data.txt", pts, "Table"]

To access them in Mathematica, you can simply do, for instance:

pts[[1]]

{1., -1., -4.48799*10^-7}

I hope this helps.

$\endgroup$
2
  • 1
    $\begingroup$ More directly you can get the points with plot1[[1,1]] $\endgroup$ Apr 23, 2019 at 10:33
  • $\begingroup$ This is outstanding helpful. It also works for FeatureSpacePlot3D and DimensionReduce. $\endgroup$ Apr 19, 2021 at 2:14

Your Answer

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

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