12

I would like my extra x tick label to be on the top of the graph, so that it would not interfere with the others tick labels. How can I manage to do that?

Here is a minimal working example:

\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
 \begin{axis}[
  xmin=0,xmax=3,
  ymin=0,ymax=15,
  extra x ticks={2.2},
  extra x tick style={grid=major},
  extra x tick labels={Cut},
  ]
  \addplot {exp(x)};
\end{axis}
\end{tikzpicture}
\end{document}

and the corresponding result:

enter image description here

I would like the "Cut" mention to be written above.

Thank you for your help!

0

1 Answer 1

12

You can do this like this by changing the ticklabel position.

% arara: pdflatex

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.13}

\begin{document}
\begin{tikzpicture}
    \begin{axis}[%
        ,xmin=0,xmax=3
        ,ymin=0,ymax=15
        ,extra x ticks={2.2}
        ,extra x tick style={%
            ,grid=major
            ,ticklabel pos=top
            }
        ,extra x tick labels={Cut}
        ]
        \addplot {exp(x)};
    \end{axis}
\end{tikzpicture}
\end{document}

enter image description here

4
  • Ah, I guess this is what the OP was asking. Will delete my answer. Commented Jul 8, 2015 at 15:47
  • 2
    @GonzaloMedina Just leave it. It never hurts to see some other approaches. And as long as the question is not 100 % clear...
    – LaRiFaRi
    Commented Jul 8, 2015 at 15:49
  • 1
    Thank you, this is what I want. I attempted several things and was not very far, but writing "right" instead of "top" is something strange I haven't thought about.
    – Tobard
    Commented Jul 8, 2015 at 16:59
  • @Tobard I can't remember, if I have tried "top" when I wrote my answer and I cannot find any change log about a fix with ticklabel pos but anyhow: It works with top now. Which makes much more sense than right. (Maybe the fix is here: sourceforge.net/p/pgfplots/bugs/86)
    – LaRiFaRi
    Commented Mar 9, 2016 at 9:19

You must log in to answer this question.

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