4

I do have the following code to get a surf plot which gives me for some reason the 'backside' of the plot with full opacity. How can I change this behavior? Actually, I think this feature is very nice, but I'd like to control it, if possible.

So question nr 1 would be: How to get rid of this and get the 'normal' behavior?

nr 2: How can I control (change the opacity etc) the behavior of the 'backside'?

\documentclass{standalone}
\usepackage{pgfplots,tikz}
\begin{document}
\begin{tikzpicture}
\begin{axis}[%
width=\linewidth,
height=0.9\linewidth,
view={-142}{40},
%scale only axis,
xmin=0,
xmax=0.5,
xtick={0,0.1,0.2,0.3,0.4,0.5},
xmajorgrids,
ymin=0,
ymax=30,
ytick={0,10,20,30},
ymajorgrids,
zmin=0,
zmax=1,
ztick={0,0.2,0.4,0.6,0.8,1},
zmajorgrids
]
\addplot3[%
surf,
%opacity=0.3,fill opacity=0.8,
shader=faceted,
draw=black,
colormap/jet,
mesh/rows=51
]
table[row sep=crcr,header=false] {data.txt};
\end{axis}
\end{tikzpicture}%
\end{document}

Since the data file is quite large, I uploaded it here: http://pastebin.com/qXmpY6W5

enter image description here

Edit: Here is a MATLAB figure of the same data but from a different angle to show how it actually looks like.

enter image description here

  • 3
    Try setting z buffer=sort. – Jake Jun 24 '14 at 8:18
  • @Jake an answer? – cmhughes Jun 24 '14 at 14:08
8

In cases like this, it often helps to set z buffer = sort.

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.