2

With pgfplots I'm experiencing some trouble with tick label format with some "higher" value of coordinates. Here a sample code which is working fine:

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{figure}[htbp]
\begin{tikzpicture}
      \begin{axis}[yticklabel style={/pgf/number format/.cd,1000 sep={\,}}]
            \addplot[red] coordinates{(1, 200) (2, 1500) (3, 9000)};
      \end{axis}
\end{tikzpicture}
\end{figure}
\end{document}

But changing the of (3,9000) by (3,10000) generate this error:

! Package pgfkeys Error: I do not know the key '/pgf/number format/at', to which you passed '(0,1)'

What's happening?

1

It happens because you change the key family to number format and the next key after evaluating this is the position of the label which is a TikZ key. But because the current key family is /pgf/number format it appends it and hence looks for /pgf/number format/at

Use /pgf/number format/1000 sep instead (you also have to turn the scaling of the axis too).

| improve this answer | |
  • 1
    Alternatively, you can use scaled ticks=false, yticklabel style={/pgf/number format/.cd, 1000 sep={\,}}. But I agree, for a single key it's better not to use the .cd functionality. – Jake Oct 9 '16 at 15:38
  • @Jake I'm a bit inclined to see this as more than a shortcoming but less than a bug. – percusse Oct 9 '16 at 15:39
  • Yeah, I agree. Understanding this behaviour requires more knowledge of the internals of PGF and PGFPlots than a "normal" user should need to have. I think it would be good if the examples in the documentation didn't use /.cd at all, but just stuck to the full keys. – Jake Oct 9 '16 at 15:48
  • 1
    Thanks. Finally this : scaled ticks=false, yticklabel style={/pgf/number format/.cd,1000 sep={\,},fixed} works to obtain the good format for me : thousands separation and no scientific notation. – Pascal LAFON Oct 9 '16 at 16:08

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.