\documentclass{article}
% translate with >> pdflatex -shell-escape <file>

% This file is used as unit test for pgfplots, copyright by Christian Feuersaenger.
% 
% See
%   http://pgfplots.sourceforge.net/pgfplots.pdf
% for pgfplots.
%
% Any required input files (for <plot table> or <plot file> or the table package) can be downloaded
% at
% http://www.ctan.org/tex-archive/graphics/pgf/contrib/pgfplots/doc/latex/
% and
% http://www.ctan.org/tex-archive/graphics/pgf/contrib/pgfplots/doc/latex/plotdata/

\usepackage{pgfplots,pgfplotstable}
\pgfplotsset{compat=newest}

\pagestyle{empty}

\begin{document}
	\pgfnumtableread{plotdata/pgfplotstest_plot.dat} to \tableA
	\pgfnumtableread{plotdata/pgfplotstest_plot3.dat} to \tableB
\begin{tikzpicture}
	\begin{loglogaxis}[
		xlabel=Dof,
		ylabel=$L_2$ error,
		title=Read from file `pgfplotstest\_plot'
	]
		\addplot table[x=dof,y=L2] 
			from 
			\tableA;
		\addplot table[x=dof,y=L2]
			{plotdata/pgfplotstest_plot.dat};
		\legend{$d=2$\\$d=3$\\}%
	\end{loglogaxis}
	\end{tikzpicture}
\end{document}
