我能够根据自己的需要定制一个在线示例,但现在我被颜色问题困住了。如果函数5*x*sin(2*deg(x)) * y*(1-y)
是灰度的,并且半空间到目前为止是黄色 -> 黑色,那就太好了。
我该怎么做?提前谢谢您。
\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.8}
\begin{document}
\begin{tikzpicture}
\begin{axis}[grid=major,view={210}{30},
xtick={0,1},
xticklabels={{1},{0}},
ytick={0,1},
yticklabels={{$A$},{$a$}},
ztick={0,1},
zticklabels={{0},{$H$}},
]
\addplot3+[mesh,scatter,samples=10,domain=0:1]
{5*x*sin(2*deg(x)) * y*(1-y)};
\addplot3 [data cs=cart,surf,domain=0:1,samples=2, opacity=0.5]
{0.5};
\end{axis}
\end{tikzpicture}
\end{document}
答案1
您可以添加适当的颜色图。
\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.8}
\begin{document}
\begin{tikzpicture}
\begin{axis}[grid=major,view={210}{30},
xtick={0,1},
xticklabels={{1},{0}},
ytick={0,1},
yticklabels={{$A$},{$a$}},
ztick={0,1},
zticklabels={{0},{$H$}},colormap/blackwhite
]
\addplot3+[mesh,scatter,samples=10,domain=0:1]
{5*x*sin(2*deg(x)) * y*(1-y)};
\addplot3 [data cs=cart,surf,domain=0:1,samples=2, opacity=0.5,point meta=0]
{0.5};
\end{axis}
\end{tikzpicture}
\end{document}