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


    xlabel={x}, ylabel={y}, zlabel={z},
            line width=1.5pt,
            patch type=triangle quadr,
            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) };

\addplot3[  patch,
            patch type=triangle quadr,
            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) };


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

enter image description here

  • 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
  • 1
    @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.

You may also be interested in subsection "Drawing Grids" in section "5.6 Patchplots Library" of the manual - it explains the available options for patch outlines along with the current limitations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.