1

How do I shade the outside of a semicircle perpendicular to the x-axis in such a way that the color fades as one moves away from the semicircle? Thanks for the help!

\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}
Salim Bou
  • 17,021
  • 2
  • 31
  • 76
tanda
  • 11

1 Answers1

2

This may be a bit silly, but would do what you are asking for.

The output

enter image description here

The code

\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}
marsupilam
  • 6,383
  • Glad it helped @tanda ! If this has solved your question please consider accepting it by clicking the check-mark. This indicates to the wider community that you've found a solution and gives some reputation to both the answerer and yourself. There is no obligation to do this. – marsupilam Feb 04 '17 at 09:23