如何对垂直于 x 轴的半圆的外部进行着色,使颜色随着远离半圆而变淡?谢谢帮助!
\begin{tikzpicture}
\draw[blue] (-1,0) .. controls (-1,0.555) and (-0.555,1) .. (0,1)
.. controls (0.555,1) and (1,0.555) .. (1,0);
\draw (-2,0) -- (2,0);
\end{tikzpicture}
答案1
这可能有点傻,但可以满足您的要求。
输出
代码
\documentclass[tikz,border=5pt]{standalone}
\begin{document}
\begin{tikzpicture}
\def\ymax{3}
\def\xmax{3}
\begin{scope}
\clip (-\xmax, 0) rectangle (\xmax, \ymax) ;
\shade[inner color=red,outer color=white] (0,0) circle (3);
\draw[blue, fill=white] (0,0) circle (1) ;
\end{scope}
\draw [thick, ->] (-\xmax,0) -- (\xmax,0) ;
\end{tikzpicture}
\end{document}