2

My question is almost the same as this, but in the linked question the user (an the answer) manually drawn the bottom line of the axis. The problem with that is that the tick marks aren't drawn as well. I adapted the MWE from the question:

\documentclass[border=1mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel=$x$,ylabel=$\sin x$,
axis x line*=top,
xmode=log, ymode=log]
\addplot[blue,mark=none,
domain=1:10,samples=40]
{exp(x)};
\end{axis}
\end{tikzpicture}
\end{document}

And the result is:

enter image description here

If I add a line in the bottom with:

...
\draw (axis description cs:0,0) -- (axis description cs:1,0);
\end{axis}
...

I get this:

enter image description here

But I want this (note the small tick lines at the bottom):

enter image description here

2

It seems to me that you only want to move the xtick labels. This can be achieved with xtick pos=both,xticklabel pos=upper.

\documentclass[border=1mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel=$x$,ylabel=$\sin x$,xtick pos=both,xticklabel pos=upper,
xmode=log, ymode=log]
\addplot[blue,mark=none,
domain=1:10,samples=40]
{exp(x)};
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

2
  • 1
    Lovely! Thanks a lot! (The side doesn't let me click the check mark just now. I'll as soon as I can) – LaTeXer Nov 3 '19 at 15:51
  • 1
    @LaTeXer In principle xticklabel pos=upper is sufficient but xtick pos=both does not hurt. ;-) – user194703 Nov 3 '19 at 16:16

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.