TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can not seem to find the way to remove the lines in the surface mesh in a 3d faceted plot. I need a solution that does not use the "shader=interp" (i.e. gradient filling) so that the faces are constant in color.

For example the following code generates white lines in Acrobat (see at the end). I tried all sorts of tricks, such as "faceted color = none, draw opacity=0., line width=0., draw=none". I made the surface semitransparent so the effect is evident.

\addplot3[surf, opacity=0.8, shader=faceted, faceted color = none, draw opacity=0., line width=0.,draw=none] %shader interp offends lualatex
coordinates {
(-3, -3, 3.57005)(-2.8125, -3, 3.50682)(-2.625, -3, 3.4438)\par
(-3, -2.8125, 3.5075)(-2.8125, -2.8125, 3.44005)(-2.625, -2.8125, 3.37252)\par
(-3, -2.625, 3.4453)(-2.8125, -2.625, 3.37336)(-2.625, -2.625, 3.301)\par
(-3, -2.4375, 3.38377)(-2.8125, -2.4375, 3.3071)(-2.625, -2.4375, 3.22959)\par

Look at the white lines:

whitelines as mesh

(Is this perhaps a bug in Acrobat?, evince shows the desired result for example)

EDIT: one of the comments states that flat should give a flat color and no lines around the patches. The result with

\addplot3[surf, opacity=0.8, shader=flat]

is that lines still appear in the borders, here with Acrobat and evince

Acrobat flat evince flat

share|improve this question
processing the pdf with imagemagik (e.g. "convert file.pdf file.jpg") produces the expected output (no white lines), even better than rendering with evince (evince has very think white lines). – alfC Jun 2 '12 at 8:39
The choice shader=flat is supposed to draw surface elements without meshes. The shader=faceted is supposed to draw mesh lines. – Christian Feuersänger Jun 2 '12 at 12:11
Thanks, I tried flat and it still produces lines (see EDIT). I though that could be simply due to the slight overlapping of semitransparent patches, but strangely enough the width of that effect depends on the parameter "line width", so it must be some sort of line. – alfC Jun 2 '12 at 17:31
up vote 5 down vote accepted

The problem is the combination between the chosen shader=flat and opacity: deactivate opacity and you do not see any edges.

Internally, the shader draws surface segments "on top of each other". It simply paints them (with fill and stroke). But since adjacent surface segments share edges, these edges are used twice for the opacity computation, resulting in different colors.

I believe this is inherent to shader=flat, there is no simple solution here (except fooling around with different fill opacity and draw opacity perhaps).

share|improve this answer
Make sense. Although, it is strange still that "line width" changes the effect. In any case, doing "line width=0pt" makes the lines slightly thinner (but not disappear) in the screen. "draw opacity=0" didn't help either, in fact it made the problem worst in acrobat. – alfC Jun 2 '12 at 22:42

Your Answer


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.