\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{2} \def\yB{3}
	 \def\xC{5} \def\yC{4}
	 \def\xD{3} \def\yD{6}
	 \def\xE{0} \def\yE{7}
	 \def\xF{-1}\def\yF{4}
	\newcommand\QUADRATICTRI[7]{%
		\begin{tikzpicture}
		\begin{axis}[title={PGFPlots triangle quadr (#7)},
			title style={text width=8cm},
			shader=#7,show nodes]
		\addplot3[patch,patch type=triangle quadr,point meta=z] coordinates {
			(\xA,\yA,#1)
			(\xC,\yC,#2)
			(\xE,\yE,#3)
			(\xB,\yB,#4)
			(\xD,\yD,#5)
			(\xF,\yF,#6)
		};
		\end{axis}
		\end{tikzpicture}
%
		}%
	\newcommand\QUADRATICTRIANGLESHAPES[1]{%
		\noindent
		\QUADRATICTRI100000{#1}%
		\QUADRATICTRI010000{#1}%

		\noindent
		\QUADRATICTRI001000{#1}%
		\QUADRATICTRI000100{#1}%

		\noindent
		\QUADRATICTRI000010{#1}%
		\QUADRATICTRI000001{#1}%
	}

	\subsection{Shape Functions Interp}
	\QUADRATICTRIANGLESHAPES{interp}

	\subsection{Shape Functions Refined}
	{
%\tracingmacros=2 \tracingcommands=2
		\subsubsection{Once}
		\QUADRATICTRIANGLESHAPES{faceted interp,mesh/refines=1}

		\subsubsection{twice}
		\QUADRATICTRIANGLESHAPES{faceted interp,mesh/refines=2}
	}

	\subsection{Shape Functions Triangulated}
	{
		\subsection{Direct: 1 Quadratic = 4 Linear}
		\QUADRATICTRIANGLESHAPES{interp,patch to triangles}

		\subsection{Addition Quadratic Refine: 1 Quadrate = 4 Quadratic = 16 linear}
		\QUADRATICTRIANGLESHAPES{interp,patch to triangles,mesh/refines=1}
	}
\end{document}
