2
$\begingroup$

How can I replace the line in the following graph by a tiny cylinder?

parametricPlot3D[ {CosSqrt[2]t, Sin[Sqrt[2]t](3+ Cos[t]), Sin[t]}, {t, 0, 100}]

$\endgroup$
3
  • $\begingroup$ ParametricPlot3D[{Cos[Sqrt[2] t], Sin[Sqrt[2] t] (3 + Cos[t]), Sin[t]}, {t, 0, 100}, PlotStyle -> AbsoluteThickness@6] ? $\endgroup$ Jun 16, 2019 at 2:48
  • $\begingroup$ That doesn't work for some reason! $\endgroup$
    – user21210
    Jun 16, 2019 at 3:06
  • $\begingroup$ So instead of [t] I need something like {Cos[t],Sin[t],s}. Can I do that? $\endgroup$
    – user21210
    Jun 16, 2019 at 3:14

1 Answer 1

5
$\begingroup$

You can post-process the output of ParametricPlot3D to change Lines into Tubes:

ParametricPlot3D[{Cos[Sqrt[2] t], Sin[Sqrt[2] t] (3 + Cos[t]), Sin[t]}, {t, 0, 100}] /. 
 Line -> (Tube[#, .05] &)

enter image description here

To get a hollow tube use CapForm[None] and use two different colors for inside and outside faces (say, FaceForm[Blue, Yellow]):

ParametricPlot3D[{Cos[Sqrt[2] t], Sin[Sqrt[2] t] (3 + Cos[t]), Sin[t]}, {t, 0, 12}] /. 
  Line ->  ({CapForm[None], FaceForm[Blue, Yellow], Tube[#, .25]} &)

enter image description here

$\endgroup$
8
  • $\begingroup$ Thank you very much. Can I have this Tube open from the edge? So it looks like a cylinder (empty from inside) $\endgroup$
    – user21210
    Jun 16, 2019 at 4:00
  • $\begingroup$ Is there any solution to get a hollow cylinder ? Thanks again! $\endgroup$
    – user21210
    Jun 16, 2019 at 4:15
  • $\begingroup$ @AbdelRahman, please see the update. $\endgroup$
    – kglr
    Jun 16, 2019 at 4:37
  • $\begingroup$ Thank you very much indeed! $\endgroup$
    – user21210
    Jun 16, 2019 at 4:46
  • $\begingroup$ @AbdelRahman, my pleasure. Welcome to mma.se and thank you for the accept. $\endgroup$
    – kglr
    Jun 16, 2019 at 4:58

Your Answer

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

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