Does anybody know the code to plot the following picture: enter image description here

Having trouble to come up with a good idea...

  • $\begingroup$ What you can do to increase the quality of the question is to give any relevant information about the surface, equations, papers, etc., instead of just gimme_teh_codez $\endgroup$
    – Sektor
    Apr 12, 2017 at 7:23
  • 2
    $\begingroup$ I'm voting to close this question as off-topic because "here is an image of what I want, please give me the code to generate it"-type of questions probably won't help future visitors. $\endgroup$
    – Sascha
    Apr 12, 2017 at 7:24

1 Answer 1


I'll leave the mesh lines and the coloring up to somebody else:

With[{c = 3, a = 1, n = 9, r = 1/3}, 
     ParametricPlot3D[{{c Cos[u], c Sin[u], 0},
                       {(c + a Cos[n u]) Cos[u], (c + a Cos[n u]) Sin[u], a Sin[n u]}},
                      {u, 0, 2 π}, ColorFunction -> (Hue[#4/(2 π)] &), 
                      ColorFunctionScaling -> False, Method -> {"TubePoints" -> 30}, 
                      PlotRange -> All] /. Line[pts_, rest___] :> Tube[pts, r, rest]]

torus spiral and torus


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.