Manual for Package pgfplots
2D/3D Plots in LATeX, Version 1.18.1
http://sourceforge.net/projects/pgfplots
The Reference
4.13Number Formatting Options
pgfplots typesets tick labels rounded to given precision and in configurable number formats. The command to do so is \pgfmathprintnumber; it uses the current set of number formatting options. In addition, pgfplots might prepare tick numbers before they are handed over to \pgfmathprintnumber.
The options related to number printing as such are described in all detail in the manual for PgfplotsTable, which comes with pgfplots. This section contains the reference for everything which is specific to an axis, and only a brief survey over the number formatting options as such.
4.13.1Frequently Used Number Printing Settings¶
This section provides a brief survey about the most frequently used aspects of number formatting in pgfplots.
-
1. pgfplots computes common tick scaling factors like \(\cdot 10^2\) and produces only integers as tick labels.
In order to get numbers like \(0.001\) as tick labels instead of \(1\) with a separate label \(\cdot 10^{-3}\), you can use scaled ticks=false in your axis. See the description of scaled ticks for details.
-
2. In order to customize the way numbers are rounded and/or displayed, use something like xticklabel style={/pgf/number format/.cd,fixed,precision=5}.
Here is a short list of possibilities:
Each of these keys requires the prefix ‘/pgf/number format/’ when used inside of a pgfplots style (try /pgf/number format/.cd,number formatting keys to use the same prefix for many number formatting keys).
The number formatting uses \pgfmathprintnumber, a pgf command to typeset numbers. A full reference of all supported options is shipped with pgfplots: it is documented in the reference manual for PgfplotsTable, Section ‘Number Formatting Options’. The same reference can be found in the documentation for pgf.
Note that the number printer knows nothing about pgfplots. In particular, it is not responsible for logs and their representation.
-
3. For a logarithmic axis, one may want to modify the number formatting style for the exponent only. In this case, redefine the style log plot exponent style (its documentation contains a couple of examples).
-
4. In order to get fixed point tick labels on a logarithmic axis, you can use log ticks with fixed point (see below).
4.13.2PGFPlots-specific Number Formatting¶
This section contains fine-tuning options to change number formatting aspects – but only things which are specific to pgfplots like peculiarities of tick labels on logarithmic axes. Consider browsing Section 4.13.1 first to see if you need this section.
-
\pgfmathprintnumber{x} ¶
Generates pretty-printed output for the (real) number x. The input number x is parsed using \pgfmathfloatparsenumber which allows arbitrary precision.
Numbers are typeset in math mode using the current set of number printing options, see below. Optional arguments can also be provided using \pgfmathprintnumber[options]{x}.
Please refer to the manual of PgfplotsTable (shipped with this package) for details about options related to number-printing.
-
/pgfplots/log ticks with fixed point(style, no value) ¶
Reconfigures pgfplots to display tick labels of logarithmic axes using fixed point numbers instead of the exponential style.
The style replaces log number format basis.
-
/pgfplots/log plot exponent style={key-value-list} ¶
Allows to configure the number format of log plot exponents. This style is installed just before ‘log number format basis’ will be invoked. Please note that this style will be installed within the default code for ‘log number format code’.
-
/pgfplots/log identify minor tick positions=true|false (initially false) ¶
Set this to true if you want to identify log plot tick labels at positions
\[ i \cdot 10^j \]
with \(i \in \{2,3,4,5,6,7,8,9\},\, j \in \mathbb {Z}\). This may be valuable in conjunction with the ‘extra x ticks’ and ‘extra y ticks’ options.
This key is set by the default styles for extra ticks.
Provides TeX code to generate log plot tick labels. Argument ‘#1’ is the (natural) logarithm of the tick position. The default implementation invokes log base 10 number format code after it changed the log basis to \(10\). It also checks the other log plot options.
This key will have a different meaning when the log basis has been chosen explicitly, see the log basis x key.
Allows to change the overall appearance of base 10 log plot tick labels. The default implementation invokes log number format basis={10}{#1}.
Use log plot exponent style if you only want to change number formatting options for the exponent.
Typesets a logarithmic tick. The first supplied argument is the log basis, the second the exponent. The initial configuration is
Use log plot exponent style if you only want to change number formatting options for the exponent.