Gnuplotting

Create scientific plots using gnuplot

March 31st, 2011 | 2 Comments

Beside the epslatex terminal, Gnuplot offers another terminal which can be used in companion with LaTeX. The tikz terminal creates only a tex file without any eps file. The trick is that it uses the tikz environment of LaTeX to draw the whole plot with TeX.

The downside is that this terminal is a new one and not available in the most standard installations of Gnuplot and it could be that there are a few bugs in comparison to epslatex.

In order to install the tikz terminal we have to compile Gnuplot by ourself with the lua flag enabled and install it the usual way:

$ ./configure --with-lua=yes
$ make
# make install

To do so we have to install lua before of course. Under Debian and Ubuntu we have to fix also two links in order to find the lua package:

# ln -s /usr/lib/pkgconfig/lua5.1.pc  /usr/lib/pkgconfig/lua.pc
# ln -s /usr/lib/liblua5.1.so  /usr/lib/liblua.so

If the installation is complete, we can use the tikz terminal in the normal way

set teminal tikz

For lots of plots in our LaTeX document we can get a problem with the TeX memory. In order to fix this use more memory for TeX by changing the memory settings in /etc/texmf/texmf.cnf. In Debian and Ubuntu this can’t be done directly, but by editing /etc/texmf/texmf.d/95NonPath.cnf and running

# update-texmf

afterwards.
The memory can be increased by changing the following lines to these new values (which are the maximum values possible).

main_memory = 7999999
extra_mem_top = 7999999
extra_mem_bot = 7999999

July 20th, 2010 | 15 Comments

Last Update: 2011-07-11

Ubuntu 10.04 (Lucid Lynx) contains not the newest Gnuplot package, but the old 4.2 version. To install Gnuplot 4.4 under Ubuntu you can download it from Debian squeeze and install it by:

wget http://ftp.us.debian.org/debian/pool/main/g/gnuplot/gnuplot-nox_4.4.0-1.1+b1_i386.deb
wget http://ftp.us.debian.org/debian/pool/main/g/gnuplot/gnuplot-doc_4.4.0-1.1_all.deb
wget http://ftp.us.debian.org/debian/pool/main/g/gnuplot/gnuplot-x11_4.4.0-1.1+b1_i386.deb
wget http://ftp.us.debian.org/debian/pool/main/g/gnuplot/gnuplot_4.4.0-1.1_all.deb
sudo dpkg -i gnuplot*

It can happen that some features of Gnuplot (for me the readline stuff) do not work as expected. If you experience problems, then you have to compile gnuplot yourself, which is in most cases straight forward. You can download it from sourceforge.