Mathematica Asked by SalahTheGoat on January 7, 2021
I am trying to make a plot that looks something like the image seen below:
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:
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!
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]
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]
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]}]]
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]
Correct answer by kglr on January 7, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP