As the title suggests, I would like a 3D plot of a lower half of a hollow torus with small radius 1 and large radius 2. I found an image online that resembles what I am looking for.

enter image description here

Could anyone find a simple way to recreate the above image, including the downward pointing blue arrow and labelled axes drawn on?

  • You've tagged the post with tikz-3dplot, have you tried that package? You should include some code for us to build off of (even just drawing the axes), rather than just asking for us to do the whole thing. Nov 19, 2017 at 14:33
  • I have no experience with the packages, or otherwise I would include a code.
    – wrb98
    Nov 19, 2017 at 15:03
  • I could perhaps learn from other codes, but I don't understand how to get a half torus, i.e. all the examples I've seen so far are of a full torus, and I cannot seem to figure out how to limit the z range of the plot to z < 0.
    – wrb98
    Nov 19, 2017 at 15:08

1 Answer 1


I present an asymptote example because this yields the arguably nicer output. However, the parametrization of the half-torus can be used for other packages as well.

  import graph3;

  real R=4;
  real a=1;

  triple fs(pair t) {
    return ((R+a*Cos(t.y))*Cos(t.x),(R+a*Cos(t.y))*Sin(t.x),a*Sin(t.y));

  surface s=surface(fs,(0,180),(360,360),8,8,Spline);
  draw(s,surfacepen=material(green+opacity(0.6), emissivepen=0.2*white),render(compression=Low,merge=true));



Of course, one needs to run asy between two compilations.

enter image description here

It is possible to draw similar picture with pgfplots.


        axis lines=center,
        axis equal,
        y domain=180:360,

        \addplot3 [surf, color=green, opacity=0.1,faceted
        color=green!50!black,fill opacity=0.5%,faceted color=blue,z buffer=sort

enter image description here

However, the outcome is, arguably, less appealing. Of course, with additional effort one may improve this. On the other hand, the nice thing about asymptote is that there this additional effort is not necessary.

  • I was wondering, is this also possible in tikz 3d plot?
    – wrb98
    Nov 19, 2017 at 16:39
  • @wrb98 It is certainly possible. I added an example to my answer. However, I feel that it is far less straightforward to achieve satisfying results with pgfplots, but this is of course just my personal taste. I am sure that a real pgfplots expert can improve the quality of the result.
    – user121799
    Nov 19, 2017 at 17:11
  • Interesting. Is it possible to (in pgfplots ) draw the positive vertical axis over the surface? It is under (see the arrow tip).
    – Sigur
    Nov 19, 2017 at 17:11
  • @Sigur : I agree that it's odd. I tried to improve the outcome by shifting the half-torus by -0.01 in z-direction, with very limited success. But I am no pgfplots expert. I'm just a marmot. ;-)
    – user121799
    Nov 19, 2017 at 17:14
  • For the asymptote version, I assume one has to use the usual three steps of first running latex on the file, then running asy on the generated .asy file, and finally run latex again. But on the initial latex command, I get an Undefined control sequence error: ` l.13 \ASYalign (-174.145695,81.289005)(-0.500000,-0.500000){\hbox to 0pt{\inc...`.
    – murray
    Nov 19, 2017 at 21:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .