我怎样才能将这个极地心形线填充为蓝色?
\begin{tikzpicture}
\draw[thick,->,>=latex] (-2,0)--(2.5,0) node[above] {$x$};
\draw[thick,->,>=latex] (0,-2)--(0,2) node[left] {$y$};
\draw[domain=0:540,scale=1.5,samples=500] plot (\x:{cos(\x/3)^3});
\end{tikzpicture}
答案1
\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[smooth,cyan,fill=blue] plot[domain=0:540,samples=200] (\x:{cos(\x/3)^3});
\end{tikzpicture}
\end{document}
编辑:奇偶规则
就像 hpekristiansen 在评论中所说的那样,您可以避免使用以下方法填充小的相交区域even odd rule
:
\draw[even odd rule,smooth,cyan,fill=blue] plot[domain=0:540,samples=200] (\x:{cos(\x/3)^3});