TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

Is there a trick to fill the parametric plot of a catacaustic which looks closed but isn’t closed in TiKZ meaning. The Problem is the egdge which looks closed but isn’t it …


I guess I can experiment with overlay a withe area or try to clip with a limited second plot using the even odd rule but I hope theres a more comfortable way to to this.


% needs gnuplot


    \draw [thick, fill=red] plot [id=op-12,parametric]
    \draw [<-] (1.5,0) -- +(1.5,0) node [right] {Problem};
share|improve this question
up vote 8 down vote accepted

Change the domain to 0:2*pi:

enter image description here



    \draw [thick, fill=red,domain=0:2*pi] plot 
        ({2*cos(\x r)-cos(2*\x r)},{2*sin(\x r)-sin(2*\x r)});

(I haven't used Gnuplot because it's not necessary here.)

share|improve this answer
The simplicity of this is beautiful! Presumably the default domain is such that the path overruns and so when it is automatically closed (for the fill) then it joins the new endpoints which aren't where one might expect them to be. – Loop Space Nov 5 '11 at 17:48
@Andrew: that's exactly what's happening as you can see by adding \draw ({2*cos(5 r)-cos(2*5 r)},{2*sin(5 r)-sin(2*5 r)}) -- ({2*cos(-5 r)-cos(2*-5 r)},{2*sin(-5 r)-sin(2*-5 r)}); to the code. – Philippe Goutet Nov 5 '11 at 19:07
Thank you works fine even with gnuplot. Is there a reason to not use gnuplot if the internal machine is able to plot it? – Tobi Nov 5 '11 at 22:59
@Tobi: if your system is configured to be able to use gnuplot, there's no real reason not to use it. But a code not using it is more portable as you're sure it will run everywhere. – Philippe Goutet Nov 6 '11 at 15:06
OK, I knew that. But since I use many plots and the id= mechanism it should be portable to and I think the gnuplot function input is more readable than the on PGF needs. So I prefer using gnuplot :-) – Tobi Nov 6 '11 at 15:09

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.