I can not generate the chart below using gnuplot. How do I do this in TeXLive 2011? What are the commands? I wanted to use pdflatex, but can this also be done with latex. In my tests this did not generate the graph.

\draw plot[id=f1,samples=200,domain=-2:2] function{x*x};
  • 2
    This works for me. Are you following this process? The first time you run pdflatex generates a gnuplot file in addition to log, dvi, etc. Find out the name of the file created, open up gnuplot in the directory and type: load 'filename.gnuplot' (filename filled in with the correct name) which processes your gnuplot file. Now do pdflatex again on your tex file and the parabola shows up.
    – DJP
    Oct 8, 2011 at 4:10
  • @RegisdaSilva: Have you run (pdf)latex with the option --shell-escape? Oct 8, 2011 at 8:17
  • Yes, that might be even easier but I avoided that route because it is --enable-write18 for some whereas the slower process above should always work. @Regis da Silva: Marco is saying from the command line type: pdflatex --shell-escape MyFile.tex and it will create your parabola in one step. Check here for a little more.
    – DJP
    Oct 8, 2011 at 14:35

1 Answer 1


The example provided works fine for me (TeXLive 2011) with pdflatex --shell-escape. Note that the --shell-escape option is necessary. If you don't provide that option then output file will be blank.

If that does not solve your problem, I would guess that there is a problem with you gnuplot installation. Perhaps you can try some of the test cases that come wtih gnuplot and ensure that that works. Also, is your path properly set up to locate gnuplot?

It would be helpful if you would provide more details as to what do you mean by "did not generate the graph". Were there any error messages in the logs? If you put text before the tikzpicture does that get output properly? Did you have a look at the files that get generated in the directory where you are running this? Is there are *.gnuplot file generated? Perhaps you should have a look at this gnuplot tutorial and ensure that gnuplot is working.


You must log in to answer this question.

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