Manual for Package pgfplots
2D/3D Plots in LATeX, Version 1.18.1
http://sourceforge.net/projects/pgfplots
About PGFPlots: Preliminaries
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
in your preamble (see Section 4.1 for information about how to use it with ConTeXt and plain TeX).
The compat=yourversion 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 TeX where to find the files. Choose the option which fits your needs best.
2.5.3Installation in Windows¶
Windows users often use MiKTeX 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 MiKTeX, you can proceed as follows. MiKTeX provides a feature to install packages locally in its own TeX Directory Structure (TDS). The basic idea is to unzip pgfplots in a directory of your choice and configure the MiKTeX Package Manager to use this specific directory with higher priority than its default paths. If you want to do this, start the MiKTeX Settings using “Start \(\gg \) Programs \(\gg \) MiKTeX \(\gg \) Settings”. There, use the “Roots” menu section. It contains the MiKTeX 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 MiKTeX 2.8, you may need to uncheck the “Show MiKTeX-maintained root directories” button to see the newly installed path.
MiKTeX 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 MiKTeX accepts them.
2.5.4Installation of Linux Packages¶
Typically, pgfplots can be installed using the TeX package manager. A common distribution is TeXLive. In this case you can write
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 TeX to check the default search paths after /foo/bar/pgfplots. The double slash ‘//’ tells TeX 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 TeX 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 “TeX Directory Structure” (TDS) conforming directory structure, so you can simply unpack the files into a directory which is searched by TeX 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 TeX distribution).
The TDS consists of several sub directories which are searched separately, depending on what has been requested: the sub directories doc/latex/package are used for (LaTeX) documentation, the sub-directories doc/generic/package for documentation which apply to LaTeX and other TeX dialects (like plain TeX and ConTeXt which have their own, respective sub-directories) as well.
Similarly, the tex/latex/package sub-directories are searched whenever LaTeX packages are requested. The tex/generic/package sub-directories are searched for packages which work for LaTeX and other TeX dialects.
Do not forget to run texhash.
2.5.7Installation If Everything Else Fails…¶
If TeX 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.