TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
1  
Try add into axis option ticks={style={/pgf/number format/set thousands separator={\,}}},. – Zarko Jan 5 at 12:15
    
In your axis labels, n and r should probably be replaced by $n$ and $r$, respectively. – pluton Jan 5 at 14:46
    
yes @pluton, I'm going to change it – PMC1234 Jan 5 at 14:50
up vote 7 down vote accepted

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)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.