我需要制作一个部分透明的单色表面图。此外,我想控制网格线的透明度。运行此代码:
\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}
仅为面产生所需的结果。pgfplots 是否也提供了控制网格线透明度的选项?
答案1
该opacity
参数控制网格线和表面的透明度。为了使网格线更加透明,您可以添加fill opacity
和减少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}
答案2
与 相同pst-solides3d
。使用 运行它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}