[Tex/LaTex] Generating graphs with gnuplot (Gnuplot, LaTeX and tkz-fct)

gnuplottikz-pgf

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.

\documentclass{article}
\usepackage{tikz,tkz-fct}
\begin{document}
\begin{tikzpicture}
\draw plot[id=f1,samples=200,domain=-2:2] function{x*x};
\end{tikzpicture}
\end{document}

Best Answer

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.