17

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

PMC1234
  • 1,122

1 Answers1

27

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)