# LaTeX - Load table data for PGFPlots tikzpicture

My main resource to create tikzpicture graphics in PDF files generated via LaTeX is the PGFPlots Gallery. But I guess there are more than 400 examples on this page. Here a minimal example for a PGFPlots function visualisation with data loaded from an dat file.

Here a complete tex document with a minimal example that uses inline coordinates and that can be compiled to an PDF file with the following command for example.

pdflatex example.tex
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}

\begin{document}
\begin{tikzpicture}
\begin{axis}
(2, 4)
(5, 1)
(6, 5)
};
\end{axis}
\end{tikzpicture}
\end{document}

## Coordinates in external table dat file

We can put the coordinates into an file called coordinates.dat for example and replace the coordinates part with the table part in the document.

2 4
5 1
6 5
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}

\begin{document}
\begin{tikzpicture}
\begin{axis}
\end{document}