\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\pagestyle{empty}

\begin{document}

%fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
\begin{figure}[!htbp]
\centering
\resizebox{\linewidth}{!}{
\begin{tikzpicture}
    \begin{axis}[domain=0:1,legend pos=outer north east]
    \addplot[thick, color=red] table {data1.dat};
    \addplot[thick, color=blue] table {data2.dat};
    \legend{sinus, polyn. interpol}
    \end{axis}
\end{tikzpicture}
}
\end{figure}
%fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
 
\end{document}
