Combining the tikz package with gnuplot allows you to plot graphs without ever leaving your favorite editor. Adding the tikz package is straightforward as with other LaTeX packages but everytime I run into trouble installing gnuplot. As far as I can tell the following steps are sufficient and necessary to get tikz and gnuplot to play nicely together.
- Download gnuplot and unzip in some folder, e.g., C:\gnuplot. Subsequently add C:\gnuplot\bin\ as a path to your environment variables.
- If you have downloaded the windows version of gnuplot then change the name of the executable from ‘wgnuplot.exe’ to ‘gnuplot.exe’.
- gnuplot may be prevented from writing in the current directory when it is called by tikz. Use the –enable-write18 switch when compiling your document, e.g., pdflatex –enable-write18 foo.tex. If you use WinEdt, the switch can be added under Options-Executions Modes.  Note that the first ‘-‘ in –enable-write18 should be two ‘-‘.
- gnuplot doesn’t seem to like spaces in filenames.
Statistics and Data links roundup for November 23rd through December 29th | Kai Arzheimer | 19-Nov-10 at 1:46 am | Permalink
[…] Drawing graphs using tikz/pgf & gnuplot | politicaldata.org – […]
tin bui | 17-Apr-11 at 8:23 pm | Permalink
Could you tell me how to add C:\gnuplot\bin\ as a path to your environment variables?
I do not know what it means.
Thanks
indridi | 17-Apr-11 at 8:38 pm | Permalink
It depends on your operating system – here is a description for Windows 7: http://geekswithblogs.net/renso/archive/2009/10/21/how-to-set-the-windows-path-in-windows-7.aspx
If you have a different OS, googling the operating system and ‘set path environment’ should turn up a solution.