TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 6 down vote accepted

Is this OK?



        \clip (-2,0) rectangle (2,2);
        \shade[shading=color wheel] [even odd rule]
            (0,0) circle (2) (0,0) circle (1);

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

share|improve this answer
Huh, I had already found the shading=color wheel option but it didn't work. Now it does. This is great, thanks! What does the even odd rule part actually do? – rubenvb Jul 22 '14 at 11:10
Simple answer: for a shape with a multi-path boundary (like an annulus/ring) it means you don't have to worry about the directions of the paths (clockwise/counterclockwise). More complicated answer: en.wikipedia.org/wiki/Even%E2%80%93odd_rule – Andrew Kepert Jul 22 '14 at 11:25
OK, great. Thanks again! – rubenvb Jul 22 '14 at 11:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.