11

I am sure that I am repeating an old question, but I couldn't find it in the Tex Exchange browser.

I am using french mathematics nomenclature and thousand separation is a space like this 1 000 and not by a coma 1,000 (that means 1 in french). The pgfplots package make appear numbers in the thousand separation as english typesetting and I want to change it.

Illustration :

enter image description here

  • 2
    Try add into axis option ticks={style={/pgf/number format/set thousands separator={\,}}},. – Zarko Jan 5 '16 at 12:15
  • In your axis labels, n and r should probably be replaced by $n$ and $r$, respectively. – pluton Jan 5 '16 at 14:46
  • yes @pluton, I'm going to change it – PMC1234 Jan 5 '16 at 14:50
18

You can use the following key:

\pgfkeys{/pgf/number format/.cd,1000 sep={\,}}

Full MWE

\documentclass{article}

\usepackage{pgfplots}

\begin{document}

\pgfkeys{/pgf/number format/.cd,1000 sep={\,}}
\begin{tikzpicture}
    \begin{axis}
    \addplot {100*x^2};
    \end{axis}
\end{tikzpicture}
\end{document}

enter image description here

If you're just changing one key, you can use

\pgfkeys{/pgf/number format/1000 sep={\,}}

as mentioned by Jake in the comments.


In case you're often switching languages with its various number formats you'll probably use the siunitx package to do so in text. To synchronize your siunitx settings with the ticklabels, you could use:

\documentclass{article}

\usepackage{pgfplots}
\usepackage{siunitx}
\sisetup{group-digits=true,
         group-four-digits=true,
         group-separator = {\,},
         output-decimal-marker = {,}}

\pgfplotsset{
  siunitxlabels/.style={
    /pgfplots/typeset ticklabel/.code={\pgfmathparse{\tick}$\num[zero-decimal-to-integer]{\pgfmathresult}$},
  },
}

\begin{document}

\begin{tikzpicture}
    \begin{axis}[siunitxlabels
    ]
    \addplot {100*x^2};
    \end{axis}
\end{tikzpicture}
\end{document}

(inspired by answers to this question)

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.