Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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},
    ]
\addplot3[patch,
            shader=flat,
            mesh,
            draw,
            black,
            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,
            shader=flat,
            patch type=triangle quadr,
            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:

enter image description here

share|improve this question
    
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

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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