2

When using a half space (\,) as the thousangs separator it is common to only start using it for numbers larger than 10000. This is reflected, e.g., in the siunitx package:

  • \SI{1000} becomes 1000
  • \SI{12345} becomes 12 345

However, pgfplots appears to only offer

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

which adapts the thousands separator for all groups of three digits. Is there a way to change this behavior, matching the one specified above?

1 Answer 1

5

Use this

\pgfkeys{/pgf/number format/.cd,int detect,1000 sep={\,},min exponent for 1000 sep=4}

Check the page 33 of this document http://pgfplots.sourceforge.net/pgfplotstable.pdf. Hope I've helped you!

MWE:

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document}

\pgfkeys{/pgf/number format/.cd,int detect,1000 sep={\,},min exponent for 1000 sep=4}
\pgfmathprintnumber{1000};
\pgfmathprintnumber{10000}

\end{document}

Example

4
  • Seems like a good answer. Please add an MWE to allow easy testing, and you'll have my upvote.
    – frougon
    Commented Mar 5, 2020 at 17:50
  • I updated the answer @frougon. Hope it works! Commented Mar 5, 2020 at 19:08
  • 2
    Yes, though I would replace the two lines\usepackage{pgfplots} \pgfplotsset{compat=1.9} with just \usepackage{pgf}. (BTW, compat=1.9 seems very old). Maybe the OP will need an example that affects only the tick labels of a plot... but it's the OP's fault not to have provided a MWE with a plot. Thanks for this update, anyway.
    – frougon
    Commented Mar 5, 2020 at 19:25
  • I usually use pgfplots with compat=1.9 because I have some problems with the latest versions with old graphs, but yeah, you are right! Commented Mar 5, 2020 at 19:36

You must log in to answer this question.

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