\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}
\pgfplotsset{compat=1.4}
\usepgfplotslibrary{patchplots}

\pagestyle{empty}

\begin{document}
\pgfplotsset{show nodes/.style={nodes near coords=\coordindex,nodes near coords align={center}}}
	 \def\xA{0} \def\yA{0}
	 \def\xB{5} \def\yB{2}
	 \def\xC{5} \def\yC{4}
	 \def\xD{1} \def\yD{5}
\begin{tikzpicture}
	\begin{axis}[title=PGFPlots bilinear (interp)]
	\addplot[patch,patch type=bilinear,shader=interp,point meta=explicit] coordinates {
		(\xA,\yA) [1] 
		(\xB,\yB) [0]
		(\xC,\yC) [0]
		(\xD,\yD) [0]
	};
	\pgfplotsextra{\foreach \n in {A,B,C,D} \node at (axis cs:\csname x\n\endcsname,\csname y\n\endcsname) {\n};}
	\end{axis}
	\end{tikzpicture}
\end{document}
