6
$\begingroup$

I am trying to make a plot that looks something like the image seen below:

Text So far I have the following code:

ListPointPlot3D[
Table[{i, Cos[i], Sin[i]}, {i, -4 \[Pi], 4 \[Pi], 0.2}], 
AxesStyle -> Thick, AxesLabel -> {"x", "y", "z"}, Filling -> Axis, 
AxesOrigin -> {0, 0, 0}, Boxed -> False]

which yields the output: Text

My problem is that the 'stalks'/'stems' of the points are all originating from the projection of the points onto the xy plane. Is there a way for me to get the stems to originate from the x axis alone so that it mimics the first photo attached?

Any help would be greatly appreciated!

$\endgroup$
  • 1
    $\begingroup$ Graphics3D[{Red, Arrowheads -> 1/100, Arrow /@ Table[{{i, 0, 0}, {i, Cos[i], Sin[i]}}, {i, -4 \[Pi], 4 \[Pi], \[Pi]/12}]}, Axes -> True, AxesStyle -> Thick, AxesLabel -> {"x", "y", "z"}, AxesOrigin -> {0, 0, 0}, PlotRange -> {{-4 \[Pi], 4 \[Pi]}, {-2, 2}, {-2, 2}}, ViewPoint -> {2 \[Pi], -1, 1}, Boxed -> False ] $\endgroup$ – LouisB Jul 21 at 9:33
7
$\begingroup$

You can use Graphics3D

Graphics3D[{Green, Tube[{{0, 0, 0}, {2 Pi, 0, 0}}, .04], 
  Table[{Sphere[{i, Cos[i], Sin[ i]}, .05], 
    Tube[{{i, 0, 0}, {i, Cos[ i], Sin[ i]}}, .04]}, 
   {i, 0, 2 Pi, 2 Pi/30}]},
  ImageSize -> Large, Boxed -> False]

enter image description here

or

Graphics3D[{Green, Tube[{{0, 0, 0}, {2 Pi, 0, 0}}, .04], 
  {Sphere[{#, Cos[ #], Sin[ #]}, .05], 
   Tube[{{#, 0, 0}, {#, Cos[ #], Sin[ #]}}, .04]} & /@ 
   Subdivide[0, 2 Pi, 30]}, 
 ImageSize -> Large, Boxed -> False]

enter image description here

Alternatively, you can use ParametricPlot3D

Show[ParametricPlot3D[{t, v Cos[t], v Sin[t]}, {t, 0, 2 Pi}, {v, 0, 1}, 
  MeshFunctions -> {#4 &}, Mesh -> 30, 
  MeshStyle -> {Green, Tube[.05]}, 
  PlotStyle -> None, Boxed -> False, Axes -> False], 
 ParametricPlot3D[{t, 0, 0}, {t, 0, 2 Pi}, PlotStyle -> {Green, Tube[.05]}]]

enter image description here

Update: "make the ends of the tubes arrow heads? So that they resemble vectors emanating from the x axis."

Show[Normal[ParametricPlot3D[{t, v Cos[t], v Sin[t]}, {t, 0, 2 Pi}, {v, 0, 1}, 
    MeshFunctions -> {#4 &}, Mesh -> 30, MeshStyle -> Green, 
    PlotStyle -> None, Boxed -> False, Axes -> False]] /. 
  Line[x_] :> {Arrowheads[.05], Arrow[Tube[SortBy[x, Abs@ #[[2]] &], .05]]}, 
 ParametricPlot3D[{t, 0, 0}, {t, 0, 2 Pi}, 
  PlotStyle -> {Green, Tube[.05]}], ImageSize -> Large]

enter image description here

| improve this answer | |
$\endgroup$
  • $\begingroup$ These all work perfectly, thanks so much! Just out of interest, do you know of any way to use the parametricPlot3D method you've done and make the ends of the tubes arrow heads? So that they resemble vectors emanating from the x axis. $\endgroup$ – SalahTheGoat Jul 25 at 11:24
  • $\begingroup$ @Salah, please see the update. $\endgroup$ – kglr Jul 27 at 0:34

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.