[Tex/LaTex] How to draw an ellipse with a rainbow color

tikz-pgftikz-styles

I need to draw a rainbow-colored (hue colormap) ellipse in tikz.

Something like this but then in an ellipse shape, and in tikz.

I've thought about drawing to ellipses, one with rainbox filling, the other white, but I don't know how to fill a shape with a rainbow.

I have looked at questions relating to paths and colormaps, but that won't do unless I really split the ellipse in many parts, which seems like it could be done a lot easier.

Best Answer

Is this OK?

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{shadings}

\begin{document}
\begin{tikzpicture}
    \begin{scope}[xscale=2]
        \clip (-2,0) rectangle (2,2);
        \shade[shading=color wheel] [even odd rule]
            (0,0) circle (2) (0,0) circle (1);
    \end{scope}
    \end{tikzpicture}
\end{document}

Remove the \clip if you want the full ellipse.

This was adapted from the shadings library example in the pgf manual.

enter image description here