The x tick labels in my figure disappear when I change one option in my LaTeX code.

This is my original code:



\pgfplotsset{width=15cm, compat=1.12}


\FPeval\vResult{\aB * \vL / (\aA + \aB)}

\FPeval\xResult{\xI - (\vS)^2 / (2*\aB)}


y domain=0:20,

{\tG - x/\vL + (\vL-y)^2/(2*\aA*\vL)};

\addplot3[contour gnuplot={draw color=black},thick]
{\tG - x/\vL + (\vL-y)^2/(2*\aA*\vL)};

    scale arrows=2,
{\tG - x/\vL + (\vL-y)^2/(2*\aA*\vL)};


{sqrt( (\xI - x)*(2*\aB) )};

\addplot[mark=x, mark size=5] coordinates {(\xS,\vS)} node[label={[label distance=0cm]45:{$(x^*,v^*)$}}]{} ;



and my original output

enter image description here

When I change the code by adding one line, so that it becomes

axis x line=middle,

this is the result

enter image description here

As you can see, the x axis tick labels have disappeared and I don't know why. I think it may have something to do with the fact I am using 3D plots. Any ideas how I can get my labels back (and ensure the x axis is positioned at y=0)?

  • 5
    Welcome to TeX.SE. What happend if you re-run pfdlatex again? Also, while code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. – Peter Grill Apr 20 '17 at 5:20
  • In particular, your code has a lot of custom macros. At the very least add the definition of those, so that we don't have to figure out which numbers are appropriate. – Torbjørn T. Apr 21 '17 at 12:11
  • @JohnKormylo axis x line=middle means that the x-axis is placed where y=0, not in the literal middle. As the surface plot stops at y=0, the ticklabels should be visible below it. – Torbjørn T. Apr 23 '17 at 15:27
  • snibbets, do you really want to do that though? The quiver arrows will then partly cover the ticklabels, as they would with ymin=0,clip=false. – Torbjørn T. Apr 23 '17 at 15:41
  • Thanks for your comments. I will add my solution below, although I'm not sure why it works. @PeterGrill I have edited the post and now list the entire file. – snibbets Apr 24 '17 at 1:07

I solved the problem by changing

axis x line=middle,


axis lines=middle,

which is equivalent to

axis x line=middle,
axis y line=middle,

Now I can see the tick labels on the x axis. Dunno why this works.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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