# How to draw the outlines of a patch in pgfplots?

In pgfplots the patch plot library allows to basically draw 3D bezier planes easily. This is very helpful if the exact mathematical form of a plane is not known or not important. What I have not figured out is how to draw additionally the outline of such a patch. In principle the mesh option allows to draw all lines but this also draws the 'inner' lines.

I tried painting both on top of each other but that fails if the plane is slightly transparent and looks wrong. Is there any way to fix this?

My MWE looks as follows

\documentclass[tikz]{standalone}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=1.7}
\usepgfplotslibrary{patchplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[colorbar,xmin=0,xmax=2,ymin=-2,ymax=2,zmin=0,zmax=1,
xlabel={x}, ylabel={y}, zlabel={z},
view={45}{45},
]
mesh,
draw,
black,
line width=1.5pt,
patch refines={2},
]
coordinates { (0,0,0) (0,0,1) (2,0,0) (0,0,0.5) (1,0.3,0.75) (0.5,0,0) };

opacity=0.8,
patch refines={2},
]
coordinates { (0,0,0) (0,0,1) (2,0,0) (0,0,0.5) (1,0.3,0.75) (0.5,0,0) };
\end{axis}
\end{tikzpicture}

\end{document}


And the not really working output where also the inner lines are drawn in addition to the outline of the patch:

-
Would setting patch refines=0 in your mesh plot help? At least it appears to solve the task for the minimal example. –  Christian Feuersänger Mar 15 '13 at 16:13
@ChristianFeuersänger: Yes, that helps. I played around with patch to triangles=true and thought the refines are necessary for a smooth outline but that is not necessary here if I can avoid the triangles. Do you want to copy that to a small answer? –  Alexander Mar 15 '13 at 17:07

For your simple example, patch refines=0 for the mesh plot solves the problem.
In general, one can choose one of the available shaders among them shader=faceted and shader=faceted interp. These activate all patch outlines. The other shaders show no patch outlines.