12

I need to make a partly transparent, one color, surface plot. Additionally I want to control the transparency of mesh lines. Running this code:

\documentclass{standalone}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[]
\addplot3[surf, color=blue, opacity=0.5, domain=-2:2, faceted color=blue] {exp(-x^2-y^2)};
\end{axis}
\end{tikzpicture}
\end{document}

Produces the desired result only for the faces. Does pgfplots provide an option to control the transparency of mesh lines too?

Transparent surface with mesh lines visible

0

2 Answers 2

15

The opacity parameter controls transparency of mesh lines and surfaces. To make mesh lines much more transparent you can add fill opacity and decrease opacity:

\documentclass{standalone}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[]
\addplot3[surf, color=blue, opacity=0.01,fill opacity=0.5, domain=-2:2, faceted color=blue] {exp(-x^2-y^2)};
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

5

the same with pst-solides3d. Run it with xelatex:

\documentclass[pstricks]{standalone}
\usepackage{pst-solides3d}
\begin{document}

\psset{viewpoint=50 20 20 rtp2xyz,Decran=50,lightsrc=viewpoint}
\begin{pspicture}(-3.5,-2)(3.5,3)
\psSurface[opacity=0.7,strokeopacity=0.4,fillcolor=blue!80,linecolor=blue!40,
           linewidth=0.2pt,algebraic,ngrid=0.1 0.1,axesboxed,
           Zmin=0,Zmax=2,showAxes=false](-2,-2)(2,2){2*e^(-x^2-y^2)}
\end{pspicture}

\end{document}

enter image description here

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.