I am trying to convert my figure from Asymptote to PDF. In Asymptote it looks fine. However, in PDF the axis appears behind the drawing.

I use the following command to produce PDF:

asy.exe -f pdf -render 0 fig.asy


import graph3;
import three;
import contour3;
currentlight = light(-9, -9, 9);
triple v1 = (1, 0, 1);
triple v2 = (0, 1, 1);
triple v3 = (2, 2, 2);
xaxis3("$x$", 0, 2.7, OutTicks(), arrow=Arrow3);
yaxis3("$y$", 0, 2.7, OutTicks(NoZero), arrow=Arrow3);
zaxis3("$z$", 0, 2.7, OutTicks(NoZero), arrow=Arrow3);

How it looks in Asymptote (version 2.38): How it appears in PDF (Adobe Reader):

Any idea or advice is really appreciated!

  • 2
    I do not know if that helps but something seemingly related is mentioned on p. 55 of this great tutorial. One reason why I cannot say more is that I cannot even reproduce the upper screen shot with your code. Nevertheless it may help if you add settings.render=0; settings.outformat="pdf";.
    – user194703
    Sep 5, 2019 at 17:36
  • Thank you for your suggestion. I have looked at p.55 and I see that certain problems exist. Unfortunately, I cannot understand how to apply that approach to my problem. Adding settings.outformat="pdf"; settings.render=0; take no effect, i.e. PDF with the same issue is produced. But if I click on PDF (enable PRC content), I see the correct image like in the upper figure.
    – Andrey L.
    Sep 6, 2019 at 10:29
  • Note: If desired you can get rid of the PRC content using settings.prc = false;. I don't think that's your primary goal, but it can make the output easier to debug. Sep 6, 2019 at 17:11

1 Answer 1


With -render=0 it is not possible to have automatic visible/hidden faces managment. It is a 2D projection of the 3D scene. The only advantage is the vectorized output. When you click on your pdf (with adobe) a 3D rendering engine is launched, the PRC engine of Adobe. If you print it or export the output it is a bitmap image and not vectorized. The main advantage is the 3D rendering with visible/hidden faces support. (in fact I do not understand why -render=0 -f pdf gives the superposition of the pdf figure and prc). It is the same with -render=n with n>0, the OpenGL engine and the output is a bitmap image. (see Errors with Asymptote)

With some efforts and for simple 3D pictures it is possible to manage by yourself the visible/hidden faces/lines. But you have to do by yourself (the painting algorithm, depending of the eye...).

In the very specific case it is possible to draw zaxis after by putting the option above=true. Try with

zaxis3("$z$", 0, 2.7, OutTicks(NoZero), arrow=Arrow3,above=true);

You must log in to answer this question.

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