我正在尝试重复使用这一页另一个极坐标图。即 r=a*sin(n.theta)。输出结果与我预期的差不多,我将在此处发布
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{pgfplots}
\pgfplotsset{width=8cm,compat=1.16}
\usepgfplotslibrary{polar}
\usepackage{subcaption}
\usepackage{floatrow}
\begin{document}
\begin{tikzpicture}
\begin{axis}[axis lines = none,
xmin=-1, xmax=1,
ymin=-1, ymax=1,
zmin=0, zmax=1,
] %<- done it in a similar way to 2D plots not quite sure it worsk liek that in 3D
\addplot3[domain=54:126,domain y=0:180,samples=31,
colormap/blackwhite,surf,%mesh,point meta=1, %<-if you want a mesh
z buffer=sort]
({(sin(5*x)*cos(x))*cos(y)},
{(sin(5*x)*cos(x))*sin(y)},
{(sin(5*x))*sin(x)});
\end{axis}
\end{tikzpicture}
\end{document}
答案1
如果您的问题是如何去除带有负片的部分z
:这是一种方法。
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{pgfplots}
\pgfplotsset{width=8cm,compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}[axis lines = none,
xmin=-1, xmax=1,
ymin=-1, ymax=1,
zmin=0, zmax=1,
] %<- done it in a similar way to 2D plots not quite sure it worsk liek that in 3D
\addplot3[domain=54:126,domain y=0:180,samples=31,
colormap/blackwhite,surf,%mesh,point meta=1, %<-if you want a mesh
z buffer=sort]
({ifthenelse((sin(5*x))*sin(x)>0,(sin(5*x)*cos(x))*cos(y),0)},
{ifthenelse((sin(5*x))*sin(x)>0,(sin(5*x)*cos(x))*sin(y),0)},
{max((sin(5*x))*sin(x),0)});
\end{axis}
\end{tikzpicture}
\end{document}
其他方法包括使用过滤器,或者仅使用其他域。