I would like to plot implicit functions in Latex with tikz and gnuplot. A minimal example of my code is given by:

    \draw plot[id=curve, raw gnuplot] function{
      f(x,y) = y**2 + (x**2 - 5)*(4*x**4 - 20*x**2 + 25);
      set xrange [-4:4];
      set yrange [-15:15];
      set view 0,0;
      set isosample 1000,1000;
      %set size square;
      set cont base;
      set cntrparam levels incre 0,0.1,0;
      unset surface;
      splot f(x,y)

This generates the following ugly output. I expected to get a smooth plot. Output generated by the code

The problem occured with MikTex 2.9 on Windows 7. The version of pgf is 3.0.0 according to the Miktex Package Manager and 2.10 according to the command \pgfversion. I assume the "correct" version number to be 3.0.0 since the files in my pgf directory where modified for the last time on 2013-12-13, this is the same day as the modification date of the 3.0.0 version on Sourceforge (http://sourceforge.net/projects/pgf/files/pgf/)

I also tried to compile the document on Ubuntu with \pgfversion 2.10. This generated the same result as on Windows.

The same problem occured here:

How to use the results of `raw output` to create a smooth plot

The problem described in the above post should be solved since 2013-07-31, see:


In the SO question Pieter furthermore proposes a hackish solution, I tried this, but it did not change the plot.

Thanks for your help!

  • I get this with miktex: i.sstatic.net/UHnJ6.png
    – user11232
    Commented Sep 12, 2014 at 22:40
  • \pgfversion gives me 3.0.0 with current TeX Live. You probably need to figure out how to update. Note that you could have two versions installed with the older one being found first when you compile. However, I don't know enough about MiKTeX or Windows to say.
    – cfr
    Commented Sep 13, 2014 at 1:06

2 Answers 2


Just for fun solution with PSTricks.


    \psplotImp[algebraic,linecolor=red,stepFactor=.3](-2.5,-12)(2.5,12){y^2 + (x^2-5)*(4*x^4-20*x^2+25)}

enter image description here


Thanks to the helpful comments I figured out that the problem to solve was to get pdflatex use version 3.0.0 of pgf.

Since the Miktex Package Manager said, that I had installed version 3.0.0 and the pgf package was not updatable, but \pgfversion displayed version 2.1 I think my MikTex installation was (for an unknown reason) broken. Therefore I decided to uninstall and reinstall Miktex.

This solved my problem. I now get the expected output, as posted by Harish Kumar:

Correct output of the code

  • I don't say thank you. The comments to my question (not the one answer, which I consider offtopic) gave me a hint how to solve the problem by myself. I thougt it would be nice to document this solution for other people with the same problem. If this is unwanted, please delete the answer again. Commented Sep 13, 2014 at 11:42

You must log in to answer this question.

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