tikz.dev / PGFplots Manual

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

About PGFPlots: Preliminaries

\(\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}}}\)

2.6Troubleshooting – Error Messages

This section discusses some problems which may occur when using pgfplots. Some of the error messages are shown in the index, take a look at the end of this manual (under “Errors”).

2.6.1Problems with available Dimen registers

To avoid problems with the many required registers for pgf and pgfplots, you may want to include

\usepackage{etex}

as first package. This avoids problems with “no room for a new dimen” in most cases. It should work with any modern installation of (it activates the \(\varepsilon \)- extensions).

2.6.2Dimension Too Large Errors

The core mathematical engine of pgf relies on registers to perform fast arithmetics. To compute \(50+299\), it actually computes 50pt+299pt and strips the pt suffix of the result. Since registers can only contain numbers up to \(\pm 16384\), overflow error messages like “Dimension too large” occur if the result leaves the allowed range. Normally, this should never happen – pgfplots uses a floating point unit with data range \(\pm 10^{324}\) and performs all mappings automatically. However, there are some cases where this fails. Some of these cases are:

  • 1. The axis range (for example, for \(x\)) becomes relatively small. It’s no matter if you have absolutely small ranges like \([10^{-17},10^{-16}]\). But if you have an axis range like \([1.99999999,2]\), where a lot of significant digits are necessary, this may be problematic.

    I guess I can’t help here: you may need to prepare the data somehow before pgfplots processes it.

  • 2. This may happen as well if you only view a very small portion of the data range.

    This happens, for example, if your input data ranges from \(x\in [0,10^6]\), and you say xmax=10.

    Consider using the restrict x to domain*=(math image)min(math image):(math image)max(math image) key in such a case, where the (math image)min(math image) and (math image)max(math image) should be (say) four times of your axis limits (see page (??) for details).

  • 3. The axis equal key will be confused if \(x\) and \(y\) have a very different scale.

  • 4. You may have found a bug – please contact the developers.

2.6.3Restrictions for DVI Viewers and dvipdfm

pgf is compatible with

  • latex/ dvips,

  • latex/ dvipdfm,

  • pdflatex,

  • \(\vdots \)

However, there are some restrictions: I don’t know any DVI viewer which is capable of viewing the output of pgf (and therefor pgfplots as well). After all, DVI has never been designed to draw something different than text and horizontal/vertical lines. You will need to view the postscript file or the PDF file.

Then, the DVI/PDF combination doesn’t support all types of shadings (for example, the shader=interp is only available for dvips, pdftex, dvipdfmx, and xetex drivers).

Furthermore, pgf needs to know a driver so that the DVI file can be converted to the desired output. Depending on your system, you need the following options:

  • latex/ dvips does not need anything special because dvips is the default driver if you invoke latex.

  • pdflatex will also work directly because pdflatex will be detected automatically.

  • lualatex will also be detected automatically.

  • latex/ dvipdfm requires to use

    \def\pgfsysdriver{pgfsys-dvipdfm.def}
    %\def\pgfsysdriver{pgfsys-pdftex.def}
    %\def\pgfsysdriver{pgfsys-dvips.def}
    %\def\pgfsysdriver{pgfsys-dvipdfmx.def}
    %\def\pgfsysdriver{pgfsys-xetex.def}
    %\def\pgfsysdriver{pgfsys-luatex.def}
    \usepackage{pgfplots}.
    

    The uncommented commands could be used to set other drivers explicitly.

Please read the corresponding sections in the PGF/TikZ manual (Sections 7.2.1 and 7.2.2) if you have further questions. These sections also contain limitations of particular drivers.

The choice which won’t produce any problems at all is pdflatex.

2.6.4Problems with ’s Memory Capacities

pgfplots can handle small up to medium sized plots. However, has never been designed for data plots – you will eventually face the problem of small memory capacities. See Section 7.1 for how to enlarge them.

2.6.5Problems with Language Settings and Active Characters

Both pgf and pgfplots use a lot of active characters – which may lead to incompatibilities with other packages which define active characters. Compatibility is better than in earlier versions, but may still be an issue. The manual compiles with the babel package for English and French, the german package does also work. If you experience any trouble, let me know. Sometimes it may work to disable active characters temporarily (babel provides such a command).

2.6.6Other Problems

Please read the mailing list at http://sourceforge.net/projects/pgfplots/support. Perhaps someone has also encountered your problem before, and maybe he came up with a solution.

Please write a note on the mailing list if you have a different problem. In case it is necessary to contact the authors directly, consider the addresses shown on the title page of this document.