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}
1
  • Do you want the color to extend below your upper semi circle or only above ?
    – marsupilam
    Commented Feb 1, 2017 at 17:22

1 Answer 1

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}
1
  • 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
    Commented Feb 4, 2017 at 9:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .