tikz.dev / PGFplots Manual

Manual for Package pgfplots
2D/3D Plots in LA, Version 1.18.1
http://sourceforge.net/projects/pgfplots

The Reference

\(\newcommand{\footnotename}{footnote}\) \(\def \LWRfootnote {1}\) \(\newcommand {\footnote }[2][\LWRfootnote ]{{}^{\mathrm {#1}}}\) \(\newcommand {\footnotemark }[1][\LWRfootnote ]{{}^{\mathrm {#1}}}\) \(\let \LWRorighspace \hspace \) \(\renewcommand {\hspace }{\ifstar \LWRorighspace \LWRorighspace }\) \(\newcommand {\mathnormal }[1]{{#1}}\) \(\newcommand \ensuremath [1]{#1}\) \(\newcommand {\LWRframebox }[2][]{\fbox {#2}} \newcommand {\framebox }[1][]{\LWRframebox } \) \(\newcommand {\setlength }[2]{}\) \(\newcommand {\addtolength }[2]{}\) \(\newcommand {\setcounter }[2]{}\) \(\newcommand {\addtocounter }[2]{}\) \(\newcommand {\arabic }[1]{}\) \(\newcommand {\number }[1]{}\) \(\newcommand {\noalign }[1]{\text {#1}\notag \\}\) \(\newcommand {\cline }[1]{}\) \(\newcommand {\directlua }[1]{\text {(directlua)}}\) \(\newcommand {\luatexdirectlua }[1]{\text {(directlua)}}\) \(\newcommand {\protect }{}\) \(\def \LWRabsorbnumber #1 {}\) \(\def \LWRabsorbquotenumber "#1 {}\) \(\newcommand {\LWRabsorboption }[1][]{}\) \(\newcommand {\LWRabsorbtwooptions }[1][]{\LWRabsorboption }\) \(\def \mathchar {\ifnextchar "\LWRabsorbquotenumber \LWRabsorbnumber }\) \(\def \mathcode #1={\mathchar }\) \(\let \delcode \mathcode \) \(\let \delimiter \mathchar \) \(\def \oe {\unicode {x0153}}\) \(\def \OE {\unicode {x0152}}\) \(\def \ae {\unicode {x00E6}}\) \(\def \AE {\unicode {x00C6}}\) \(\def \aa {\unicode {x00E5}}\) \(\def \AA {\unicode {x00C5}}\) \(\def \o {\unicode {x00F8}}\) \(\def \O {\unicode {x00D8}}\) \(\def \l {\unicode {x0142}}\) \(\def \L {\unicode {x0141}}\) \(\def \ss {\unicode {x00DF}}\) \(\def \SS {\unicode {x1E9E}}\) \(\def \dag {\unicode {x2020}}\) \(\def \ddag {\unicode {x2021}}\) \(\def \P {\unicode {x00B6}}\) \(\def \copyright {\unicode {x00A9}}\) \(\def \pounds {\unicode {x00A3}}\) \(\let \LWRref \ref \) \(\renewcommand {\ref }{\ifstar \LWRref \LWRref }\) \( \newcommand {\multicolumn }[3]{#3}\) \(\require {textcomp}\) \( \newcommand {\meta }[1]{\langle \textit {#1}\rangle } \) \(\newcommand {\toprule }[1][]{\hline }\) \(\let \midrule \toprule \) \(\let \bottomrule \toprule \) \(\def \LWRbooktabscmidruleparen (#1)#2{}\) \(\newcommand {\LWRbooktabscmidrulenoparen }[1]{}\) \(\newcommand {\cmidrule }[1][]{\ifnextchar (\LWRbooktabscmidruleparen \LWRbooktabscmidrulenoparen }\) \(\newcommand {\morecmidrules }{}\) \(\newcommand {\specialrule }[3]{\hline }\) \(\newcommand {\addlinespace }[1][]{}\) \(\require {colortbl}\) \(\let \LWRorigcolumncolor \columncolor \) \(\renewcommand {\columncolor }[2][named]{\LWRorigcolumncolor [#1]{#2}\LWRabsorbtwooptions }\) \(\let \LWRorigrowcolor \rowcolor \) \(\renewcommand {\rowcolor }[2][named]{\LWRorigrowcolor [#1]{#2}\LWRabsorbtwooptions }\) \(\let \LWRorigcellcolor \cellcolor \) \(\renewcommand {\cellcolor }[2][named]{\LWRorigcellcolor [#1]{#2}\LWRabsorbtwooptions }\) \(\newcommand {\intertext }[1]{\text {#1}\notag \\}\) \(\let \Hat \hat \) \(\let \Check \check \) \(\let \Tilde \tilde \) \(\let \Acute \acute \) \(\let \Grave \grave \) \(\let \Dot \dot \) \(\let \Ddot \ddot \) \(\let \Breve \breve \) \(\let \Bar \bar \) \(\let \Vec \vec \) \(\newcommand {\nicefrac }[3][]{\mathinner {{}^{#2}\!/\!_{#3}}}\)

4.15Tick Options

4.15.1Tick Coordinates and Label Texts
  • /pgfplots/xtick=\empty|data|{(math image)coordinate list(math image)} (initially {(math image)(math image)})

  • /pgfplots/ytick=\empty|data|{(math image)coordinate list(math image)} (initially {(math image)(math image)})

  • /pgfplots/ztick=\empty|data|{(math image)coordinate list(math image)} (initially {(math image)(math image)})

  • These options assign a list of positions where ticks shall be placed. The argument is either the empty string (which is the initial value), the command \empty, the special string ‘data’ or a list of coordinates. The initial configuration of an empty string means to generate these positions automatically. The choice \empty will result in no tick at all. The special value ‘data’ will produce tick marks at every coordinate of the first plot. Otherwise, tick marks will be placed at every coordinate in (math image)coordinate list(math image).

    The (math image)coordinate list(math image) will be used inside of a \foreach \x in {(math image)coordinate list(math image)} statement. The format is as follows:

    • {0,1,2,5,8,1e1,1.5e1} (a series of coordinates),

    • {0,...,5} (the same as {0,1,2,3,4,5}),

    • {0,2,...,10} (the same as {0,2,4,6,8,10}),

    • {9,...,3.5} (the same as {9, 8, 7, 6, 5, 4}),

    • See [7, Section 34] for a more detailed definition of the options.

    • Please be careful with white spaces inside of (math image)coordinate list(math image) (at least around the dots).

    For log plots, pgfplots will apply \(\log (\cdot )\) to each element in ‘(math image)coordinate list(math image)’ (similarly, any custom transformations are applied to the argument list).

    (-tikz- diagram)

    % Preamble: \pgfplotsset{width=7cm,compat=1.18} \begin{tikzpicture} \begin{loglogaxis}[ xtick={ 12, 9897, 1468864 }, ] % see above for this macro: \plotcoords \end{loglogaxis} \end{tikzpicture}

    (-tikz- diagram)

    % Preamble: \pgfplotsset{width=7cm,compat=1.18} \begin{tikzpicture} \begin{axis}[ xtick=\empty, ytick={-2,0.3,3,3.7,4.5}, ] \addplot+ [smooth] coordinates { (-2,3) (-1.5,2) (-0.3,-0.2) (1,1.2) (2,2) (3,5) }; \end{axis} \end{tikzpicture}

Attention:

You can’t use the ‘...’ syntax if the elements are too large for ! For example, ‘xtick=1.5e5,2e7,3e8’ will work (because the elements are interpreted as strings, not as numbers), but ‘xtick=1.5,3e5,...,1e10’ will fail because it involves real number arithmetics beyond ’s capacities.

The default choice for tick positions in normal plots is to place a tick at each coordinate \(i\cdot h\). The step size \(h\) depends on the axis scaling and the axis limits. It is chosen from a list of “feasible” step sizes such that neither too much nor too few ticks will be generated. The default for log plots is to place ticks at positions \(10^i\) in the axis’ range. The positions depend on the axis scaling and the dimensions of the picture. If log plots contain just one (or two) positions \(10^i\) in their limits, ticks will be placed at positions \(10^{i\cdot h}\) with “feasible” step sizes \(h\) as in the case of linear axis.

The tick appearance can be (re)configured with

\pgfplotsset{tick style={very thin,gray}} % modifies the style `every tick' \pgfplotsset{minor tick style={black}} % modifies the style `every minor tick'

These style commands can be used at any time. The tick line width can be configured with ‘major tick length’ and ‘minor tick length’.

(-tikz- diagram)

% Preamble: \pgfplotsset{width=7cm,compat=1.18} \begin{tikzpicture} \begin{axis}[ xtick=data, xmajorgrids, ] \addplot coordinates { (1,2) (2,5) (4,6.5) (6,8) (10,9) }; \end{axis} \end{tikzpicture}

(-tikz- diagram)

% Preamble: \pgfplotsset{width=7cm,compat=1.18} \begin{tikzpicture} \begin{loglogaxis}[ title=A log plot with small axis range, ] \addplot coordinates { (10,1e-4) (17,8.3176e-05) (25,7.0794e-05) (50,5e-5) }; \end{loglogaxis} \end{tikzpicture}
  • /pgfplots/xtickten={(math image)exponent base 10 list(math image)}

  • /pgfplots/ytickten={(math image)exponent base 10 list(math image)}

  • /pgfplots/ztickten={(math image)exponent base 10 list(math image)}

  • These options allow to place ticks at selected positions \(10^k, k \in \text {\marg {exponent base 10 list}}\). They are only used for log plots. The syntax for {(math image)exponent base 10 list(math image)} is the same as above for xtick={(math image)list(math image)} or ytick={(math image)list(math image)}.

    Using ‘xtickten={1,2,3,4}’ is equivalent to ‘xtick={1e1,1e2,1e3,1e4}’, but it requires fewer computational time and it allows to use the short syntax ‘xtickten={1,...,4}’.

    (-tikz- diagram)

    % Preamble: \pgfplotsset{width=7cm,compat=1.18} \begin{tikzpicture} \begin{semilogyaxis}[ samples=8, ytickten={-6,-4,...,4}, domain=0:10, ] \addplot {2^(-2*x + 6)}; \addlegendentry{$2^{-2x + 6}$} % or invoke gnuplot to generate coordinates: \addplot gnuplot [id=pow2] {2**(-1.5*x -3)}; \addlegendentry{$2^{-1.5x -3}$} \end{semilogyaxis} \end{tikzpicture}

    In case log basis x\(\,\neq 10\), the meaning of xtickten changes. In such a case, xtickten will still assign the exponent, but for the chosen log basis x instead of base \(10\).

  • /pgfplots/xticklabels={(math image)label list(math image)}

  • /pgfplots/yticklabels={(math image)label list(math image)}

  • /pgfplots/zticklabels={(math image)label list(math image)}

  • Assigns a list of tick labels to each tick position. Tick positions are assigned using the xtick and ytick options.

    This is one of two options to assign tick labels directly. The other option is xticklabel={(math image)command(math image)} (or yticklabel={(math image)command(math image)}). The option ‘xticklabel’ offers higher flexibility while ‘xticklabels’ is easier to use. See also the variant xticklabels from table.

    The argument (math image)label list(math image) has the same format as for ticks, that means

    xticklabels={$\frac{1}{2}$,$e$}

    denotes the two element list \(\{\frac 12, e\}\). The list indices match the indices of the tick positions. If you need commas inside of list elements, use

    xticklabels={{0,5}, $e$}.

    (-tikz- diagram)

    % Preamble: \pgfplotsset{width=7cm,compat=1.18} \begin{tikzpicture} \begin{axis}[ xtick={-1.5,-1,...,1.5}, xticklabels={% $-1\frac 12$, $-1$, $-\frac 12$, $0$, $\frac 12$, $1$}, % note: \frac can be done automatically: % xticklabel style={/pgf/number format/frac}, ] \addplot [smooth,blue,mark=*] coordinates { (-1, 1) (-0.75, 0.5625) (-0.5, 0.25) (-0.25, 0.0625) (0, 0) (0.25, 0.0625) (0.5, 0.25) (0.75, 0.5625) (1, 1) }; \end{axis} \end{tikzpicture}

    (-tikz- diagram)

    % Preamble: \pgfplotsset{width=7cm,compat=1.18} \begin{tikzpicture} \begin{semilogyaxis}[ ytickten={-2,-1,0,1,2}, yticklabels={ $\frac{1}{100}$, $\frac{1}{10}$, 1,10,100 }, ] \addplot {exp(x)}; \end{semilogyaxis} \end{tikzpicture}

    Note that it is also possible to terminate list entries with two backslashes, \\. In that case, the last entry needs to be terminated by \\ as well (it is the same alternative syntax which is also accepted for \legend and cycle list).

    Please keep in mind that the arguments always refer the a list of tick positions, although it does not alter or define the list of positions. Consequently, you should also provide the list of positions. Note that a list of positions might be longer than what is actually displayed (in case the axis limits clip some of the value away), but the index mapping into (math image)label list(math image) still includes the clipped values.

  • /pgfplots/xticklabels from table={(math image)\table or filename(math image)}{(math image)colname(math image)}

  • /pgfplots/yticklabels from table={(math image)\table or filename(math image)}{(math image)colname(math image)}

  • /pgfplots/zticklabels from table={(math image)\table or filename(math image)}{(math image)colname(math image)}

  • A variant of xticklabels={(math image)list(math image)} which uses each entry in the column named (math image)colname(math image) from a table as tick labels.

    The first argument (math image)\table or filename(math image) can be either a loaded table macro (i.e. the result of \pgfplotstableread{(math image)file name(math image)}{(math image)\table(math image)}) or just a file name.

    The second argument can be a column name, a column alias or a create on use specification (see PgfplotsTable for the latter two). Furthermore, it can be [index](math image)integer(math image) in which case (math image)integer(math image) is a column index.

    The behavior of xticklabels from table is the same as if the column (math image)colname(math image) would have been provided as comma separated list to xticklabels. This means the column can contain text, macros or even math mode.

    If you have white spaces in your cells, enclose the complete cell in curly braces, {example cell}. The detailed input format for tables is discussed in \addplot table and in the documentation for PgfplotsTable.

  • /pgfplots/extra x tick label={(math image) code(math image)}

  • /pgfplots/extra y tick label={(math image) code(math image)}

  • /pgfplots/extra z tick label={(math image) code(math image)}

  • As xticklabel provides code to generate tick labels for each xtick, the key extra x tick label provides code to generate tick labels for every element in extra x ticks.

  • /pgfplots/extra x tick labels={(math image)label list(math image)}

  • /pgfplots/extra y tick labels={(math image)label list(math image)}

  • /pgfplots/extra z tick labels={(math image)label list(math image)}

  • As xticklabels provides explicit tick labels for each xtick, the key extra x tick labels provides explicit tick labels for every element in extra x ticks.

  • /pgfplots/xminorticks=true|false (initially true)

  • /pgfplots/yminorticks=true|false (initially true)

  • /pgfplots/zminorticks=true|false (initially true)

  • /pgfplots/xmajorticks=true|false (initially true)

  • /pgfplots/ymajorticks=true|false (initially true)

  • /pgfplots/zmajorticks=true|false (initially true)

  • /pgfplots/ticks=minor|major|both|none (initially both)

  • Enables/disables the small tick lines either for single axis or for all of them. Major ticks are those placed at the tick positions and minor ticks are between tick positions. Please note that minor ticks are automatically disabled if xtick is not a uniform range.60

    The key minor tick length={(math image)dimen(math image)} configures the tick length for minor ticks while the major variant applies to major ticks. You can configure the appearance using the following styles:

    \pgfplotsset{every tick/.append style={color=black}} % applies to major and minor ticks, \pgfplotsset{every minor tick/.append style={thin}} % applies only to minor ticks, \pgfplotsset{every major tick/.append style={thick}} % applies only to major ticks.

    There is also the style “every tick” which applies to both, major and minor ticks.

  • /pgfplots/xtickmin={(math image)coord(math image)}

  • /pgfplots/ytickmin={(math image)coord(math image)}

  • /pgfplots/ztickmin={(math image)coord(math image)}

  • /pgfplots/xtickmax={(math image)coord(math image)}

  • /pgfplots/ytickmax={(math image)coord(math image)}

  • /pgfplots/ztickmax={(math image)coord(math image)}

  • These keys can be used to modify minimum/maximum values before ticks are drawn. Because this applies to axis discontinuities, it is described on page (??) in Section 4.9.12, “Axis Discontinuities”.

60 A uniform list means the difference between all elements is the same for linear axis or, for logarithmic axes, \(\log (10)\).

4.15.2Tick Alignment: Positions and Shifts
  • /pgfplots/xtick pos=lower|upper|bottom|top|left|right|both (initially both)

  • /pgfplots/ytick pos=lower|upper|bottom|top|left|right|both (initially both)

  • /pgfplots/ztick pos=lower|upper|bottom|top|left|right|both (initially both)

  • /pgfplots/tick pos=lower|upper|bottom|top|left|right|both

  • Allows to choose where to place the small tick lines. In the default configuration, this does also affect tick labels, see below. The tick pos style sets all of them to the same value (aliased by tickpos). This option is only useful for boxed axes.

    Note that the keys left and bottom are aliases for lower. Similarly, right and top are aliases for upper.

    Changing tick pos will also affect the placement of tick labels.

    Note that it can also affect the axis lines key, although not all combinations make sense. Make sure the settings are consistent.

  • /pgfplots/xticklabel pos=lower|upper|bottom|top|left|right|default (initially default)

  • /pgfplots/yticklabel pos=lower|upper|bottom|top|left|right|default (initially default)

  • /pgfplots/zticklabel pos=lower|upper|bottom|top|left|right|default (initially default)

  • /pgfplots/ticklabel pos=lower|upper|bottom|top|left|right|default (initially default)

  • Allows to choose where to place tick labels. The choices lower and upper place tick labels either at the lower or at the upper side of the complete axis. The choice default uses the same setting as xtick pos (or ytick pos). This option is only useful for boxed axes – keep it to default for non-boxed figures. The ticklabel pos style sets all three of them to the same value.

    Note that the keys left and bottom are aliases for lower. Similarly, right and top are aliases for upper.

  • /pgfplots/xticklabel shift={(math image)dimension(math image)} (initially empty)

  • /pgfplots/yticklabel shift={(math image)dimension(math image)} (initially empty)

  • /pgfplots/zticklabel shift={(math image)dimension(math image)} (initially empty)

  • /pgfplots/ticklabel shift={(math image)dimension(math image)} (initially empty)

  • Shifts tick labels in direction of the outer unit normal of the axis by an amount of (math image)dimension(math image). The ticklabel shift sets the same value for all axes.

    This is usually unnecessary as the anchor of a tick label already yields enough spacing in most cases.

    See also axis line shift.

4.15.3Tick Scaling – Common Factors In Ticks
  • /pgfplots/scaled ticks=true|false|base 10:(math image)e(math image)|real:(math image)num(math image)|manual:{(math image)label(math image)}{(math image)code(math image)} (initially true)

  • /pgfplots/scaled x ticks=(math image)one of the values(math image) (initially true)

  • /pgfplots/scaled y ticks=(math image)one of the values(math image) (initially true)

  • /pgfplots/scaled z ticks=(math image)one of the values(math image) (initially true)

  • Allows to factor out common exponents in tick labels for linear axes. For example, if you have tick labels \(20000,40000\) and \(60000\), you may want to save some space and write \(2,4,6\) with a separate factor ‘\(\cdot 10^4\)’. Use ‘scaled ticks=true’ to enable this feature. In case of true, tick scaling will be triggered if the data range is either too large or too small (see below).

    (-tikz- diagram)

    % Preamble: \pgfplotsset{width=7cm,compat=1.18} \begin{tikzpicture} \begin{axis}[scaled ticks=true] \addplot coordinates { (20000,0.0005) (40000,0.0010) (60000,0.0020) }; \end{axis} \end{tikzpicture}%

    (-tikz- diagram)

    % Preamble: \pgfplotsset{width=7cm,compat=1.18} \begin{tikzpicture} \begin{axis}[ scaled ticks=false, ] \addplot coordinates { (20000,0.0005) (40000,0.0010) (60000,0.0020) }; \end{axis} \end{tikzpicture}

    The scaled ticks key is a style which simply sets scaled ticks for both, \(x\) and \(y\).

    The value base 10:(math image)e(math image) allows to adjust the algorithm manually. For example, base 10:3 will divide every tick label by \(10^3\):

    (-tikz- diagram)

    % Preamble: \pgfplotsset{width=7cm,compat=1.18} \begin{tikzpicture} \begin{axis}[ scaled ticks=base 10:3, /pgf/number format/sci subscript, ] \addplot coordinates { (-0.00001,2e12) (-0.00005,4e12) }; \end{axis} \end{tikzpicture}

    Here, the sci subscript option simply saves space. In general, base 10:\(e\) will divide every tick by \(10^e\). The effect is not limited by the “too large or too small” decisions mentioned above.

    The value real:(math image)num(math image) allows to divide every tick by a fixed (math image)num(math image). For example, the following plot is physically ranged from \(0\) to \(2\pi \), but the tick scaling algorithm is configured to divide every tick label by \(\pi \).

    (-tikz- diagram)

    % Preamble: \pgfplotsset{width=7cm,compat=1.18} \begin{tikzpicture} \begin{axis}[ xtick={0,1.5708,...,10}, domain=0:2*pi, scaled x ticks={real:3.1415}, xtick scale label code/.code={$\cdot \pi$}, ] \addplot {sin(deg(x))}; \end{axis} \end{tikzpicture}

    Setting scaled ticks=real:(math image)num(math image) also changes the tick scale label code to

    The key tick scale binop is described below, it is set initially to \cdot.

    A further – not very useful – example is shown below. Every \(x\) tick label has been divided by \(2\), every \(y\) tick label by \(3\).

    (-tikz- diagram)

    % Preamble: \pgfplotsset{width=7cm,compat=1.18} \begin{tikzpicture} \begin{axis}[ scaled x ticks=real:2, scaled y ticks=real:3, ] \addplot {x^3}; \node [pin=135:{$(3,9)$}] at (3,9) {}; \end{axis} \end{tikzpicture}

    The last option, scaled ticks=manual:{(math image)label(math image)}{(math image)code(math image)} allows even more customization. It allows full control over the displayed scaling label and the scaling code: (math image)label(math image) is used as is inside of the tick scaling label while (math image)code(math image) is supposed to be a one argument macro which scales each tick. Example:

    (-tikz- diagram)

    % Preamble: \pgfplotsset{width=7cm,compat=1.18} \begin{tikzpicture} \begin{axis}[ scaled y ticks=manual:{$+65\,535$}{ \pgfmathparse{#1-65535} }, yticklabel style={ /pgf/number format/fixed, /pgf/number format/precision=1, }, ] \addplot coordinates { (0, 65535) (13, 65535) (14, 65536) (15, 65537) (30, 65537) }; \end{axis} \end{tikzpicture}

    The example uses $+65\,535$ as tick scale label content. Furthermore, it defines the customized tick label formula \(y - (+6.5535\cdot 10^4) = y - 65535\) to generate \(y\) tick labels.

    The (math image)label(math image) can be arbitrary. It is completely in user control. The second argument, (math image)code(math image) is supposed to be a one-argument-macro in which #1 is the current tick position in floating point representation. The macro is expected to assign \pgfmathresult (as a number). The pgf manual [7] contains detailed documentation about its math engine.

    This feature may also be used do transform coordinates in case they can’t be processed with pgfplots: transform them and supply a proper tick scaling method such that tick labels represent the original range.

    If (math image)label(math image) is empty, the tick scale label won’t be drawn (and no space will be occupied).

    Tick scaling does not work for logarithmic axes.

  • /pgfplots/scale ticks below exponent={(math image)exponent(math image)} (initially -1)

  • Allows fine tuning of the ‘scaled ticks’ algorithm: if the axis limits are of magnitude \(10^e\) and \(e<\)(math image)exponent(math image), the common prefactor \(10^e\) will be factored out. The default is

  • /pgfplots/scale ticks above exponent={(math image)exponent(math image)} (initially 3)

  • Allows fine tuning of the ’scaled ticks’ algorithm: if the axis limits are of magnitude \(10^e\) and \(e>\)(math image)exponent(math image), the common prefactor \(10^e\) will be factored out.

4.15.4Tick Fine-Tuning

The tick placement algorithm depends on a number of parameters which can be tuned to get better results.

  • /pgfplots/max space between ticks={(math image)number(math image)} (initially 35)

  • Configures the maximum space between adjacent ticks in full points. The suffix “pt” has to be omitted and fractional numbers are not supported.

  • /pgfplots/try min ticks={(math image)number(math image)} (initially 4)

  • Configures a loose lower bound on the number of ticks. It should be considered as a suggestion, not a tight limit. This number will increase the number of ticks if ‘max space between ticks’ produces too few of them.

    The total number of ticks may still vary because not all fractional numbers in the axis’ range are valid tick positions.

  • /pgfplots/try min ticks log={(math image)number(math image)} (initially 3)

  • The same as try min ticks, but for logarithmic axis.

  • /pgfplots/xtick placement tolerance(initially 0.05pt)

  • /pgfplots/ytick placement tolerance(initially 0.05pt)

  • /pgfplots/ztick placement tolerance(initially 0.05pt)

  • Tick lines and labels will be placed if they are no more than this tolerance beyond the axis limits. This threshold should be chosen such that it does not produce visible differences while still providing fault tolerance.

    The threshold is given in paper units of the final figure.

  • /pgfplots/log basis x={(math image)number(math image)} (initially empty)

  • /pgfplots/log basis y={(math image)number(math image)} (initially empty)

  • /pgfplots/log basis z={(math image)number(math image)} (initially empty)

  • Allows to change the logarithms used for logarithmic axes.

    Changing to a different log basis is nothing but a scale. However, it also changes the way tick labels are displayed: they will also be shown in the new basis.

    (-tikz- diagram)   (-tikz- diagram)

    % Preamble: \pgfplotsset{width=7cm,compat=1.18} \begin{tikzpicture} \begin{semilogyaxis}[log basis y=2,grid=major,samples at={-4,...,4}] \addplot {2^x}; \end{semilogyaxis} \end{tikzpicture} ~ \begin{tikzpicture} \begin{semilogyaxis}[log basis y=10,samples at={-4,...,4}] \addplot {2^x}; \end{semilogyaxis} \end{tikzpicture}

    The initial setting is ‘log basis x=’ which defaults to: the natural logarithm for any coordinates (basis \(\exp (1)\)), and the logarithm base \(10\) for the display of tick labels.

    If the log basis is changed to something different than the empty string, the chosen logarithm will be applied to any input coordinate (if the axis scale is log as well) and tick labels will be displayed in this basis.

    In other words: usually, you see log-axes base \(10\) and that’s it. It is only interesting for coordinate filters: the initial setting (with empty (math image)number(math image)) uses coordinate lists basis \(e\) although the display will use basis \(10\) (i.e. it is rescaled). Any non-empty value (math image)number(math image) causes both, coordinate lists and display to use (math image)number(math image) as basis for the logarithm. The JavaScript code of the clickable library will always use the display basis (which is usually \(10\)) when it computes slopes.

Technical remarks.

Please note that xtickten will be used differently now: it will provide the desired ticks in the new basis! Despite the misleading name “ten”, xtickten={1,2,3,4} will yield ticks at \(2^1,2^2,2^3,2^4\) if log basis x=2 has been set.