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.5Installation and Prerequisites

2.5.1Licensing

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

A copy of the GNU General Public License can be found in the package file

doc/latex/pgfplots/gpl-3.0.txt

You may also visit http://www.gnu.org/licenses.

2.5.2Prerequisites

pgfplots requires pgf. You should generally use the most recent stable version of pgf. pgfplots is used with

\usepackage{pgfplots} \pgfplotsset{compat=1.18}

in your preamble (see Section 4.1 for information about how to use it with Cont and plain ).

The compat=(math image)yourversion(math image) entry should be added to activate new features, see the documentation of the compat key for more details.

There are several ways how to teach where to find the files. Choose the option which fits your needs best.

2.5.3Installation in Windows

Windows users often use MiK which downloads the latest stable package versions automatically. You do not need to install anything manually here.

If you want to install or more recent version of pgfplots than the one shipped with MiK, you can proceed as follows. MiK provides a feature to install packages locally in its own Directory Structure (TDS). The basic idea is to unzip pgfplots in a directory of your choice and configure the MiK Package Manager to use this specific directory with higher priority than its default paths. If you want to do this, start the MiK Settings using “Start \(\gg \) Programs \(\gg \) MiK \(\gg \) Settings”. There, use the “Roots” menu section. It contains the MiK Package directory as initial configuration. Use “Add” to select the directory in which the unzipped pgfplots tree resides. Then, move the newly added path to the list’s top using the “Up” button. Then press “Ok”. For MiK 2.8, you may need to uncheck the “Show MiK-maintained root directories” button to see the newly installed path.

MiK complains if the provided directory is not TDS conform (see Section 2.5.6 for details), so you can’t provide a wrong directory here. This method does also work for other packages, but some packages may need some directory restructuring before MiK accepts them.

2.5.4Installation of Linux Packages

Typically, pgfplots can be installed using the package manager. A common distribution is Live. In this case you can write

sudo tlmgr install pgfplots

in order to install pgfplots.

2.5.5Installation in Any Directory – the TEXINPUTS Variable

You can simply install pgfplots anywhere on your hard drive, for example into

/foo/bar/pgfplots.

Then, you set the TEXINPUTS variable to

TEXINPUTS=/foo/bar/pgfplots/tex//:

The trailing ‘:’ tells to check the default search paths after /foo/bar/pgfplots. The double slash ‘//’ tells to search all subdirectories.

If the TEXINPUTS variable already contains something, you can append the line above to the existing TEXINPUTS content.

Furthermore, you should set TEXDOCS as well,

TEXDOCS=/foo/bar/pgfplots/doc//:

so that the documentation system finds the files pgfplots.pdf and pgfplotstable.pdf (on some systems, it is then enough to use texdoc pgfplots).

Starting with pgfplots 1.12, you may also need to adopt LUAINPUTS:

LUAINPUTS=/foo/bar/pgfplots//:

should usually do the job.

Please refer to your operating systems manual for how to set environment variables.

2.5.6Installation Into a Local TDS Compliant texmf-Directory

pgfplots comes in a “ Directory Structure” (TDS) conforming directory structure, so you can simply unpack the files into a directory which is searched by automatically. Such directories are ~/texmf on Linux systems, for example.

Copy pgfplots to a local texmf directory like ~/texmf. You need at least the pgfplots directories tex/generic/pgfplots and tex/latex/pgfplots. Then, run texhash (or some equivalent path-updating command specific to your distribution).

The TDS consists of several sub directories which are searched separately, depending on what has been requested: the sub directories doc/latex/(math image)package(math image) are used for () documentation, the sub-directories doc/generic/(math image)package(math image) for documentation which apply to and other dialects (like plain and Cont which have their own, respective sub-directories) as well.

Similarly, the tex/latex/(math image)package(math image) sub-directories are searched whenever packages are requested. The tex/generic/(math image)package(math image) sub-directories are searched for packages which work for and other dialects.

Do not forget to run texhash.

2.5.7Installation If Everything Else Fails…

If still doesn’t find your files, you can copy all .sty and all .code.tex files (perhaps all .def files as well) into your current project’s working directory. In fact, you need everything which is in the tex/latex/pgfplots and tex/generic/pgfplots sub directories.

Please refer to http://www.ctan.org/installationadvice/ for more information about package installation.