I’ve been using Gnuplot a little bit before discovering R. However, as I recently found myself answering some Gnuplot-related questions on stackoverflow.com and stats.stackexchange.com, I decided to reinstall my old gnuplot which was by far and large broken: no mouse support, no aqua terminal, etc.

  cvs -z3 -d:pserver:anonymous@gnuplot.cvs.sourceforge.net:/cvsroot/gnuplot co \
  -P gnuplot

I wanted aqua support because it has a nice rendering and export to PDF is made easy thanks to the Quartz device. I already have Aquaterm installed on my Airbook, but it is well known that it is only available in 32-bit mode. This means that we need to build Gnuplot for 32-bit (aka, i386) architecture, although I found some webpages showing that we can patch Aquaterm to run in 64-bit mode. Anyway, let’s go for an i386 architecture. I don’t really care because this is what I’m actually running most of the time.

As we also want tikz and lua support (for exporting to Latex), we need liblua. I already have Lua 5.1, but it was built for 64-bit architecture. So, I downloaded it again and recompile it, following the standard instructions. Note that the default is an x86_64 binary whereas I need to have an i386 build too. I used this modified Makefile (replace the default src/Makefile by this one after having removes the suffix). Also, we need to have a dylib library, and not the default liblua.a that is generated by the Makefile. In short, in the source directory:

    make macosx
    sudo make install
    make -C src liblua.dylib
    sudo cp src/liblua.dylib /usr/local/lib/

Then, in the CVS directory for Gnuplot:

    arch_flags="-arch i386"
    ./configure CFLAGS="$arch_flags" CXXFLAGS="$arch_flags" CPPFLAGS="$arch_flags" \
    LDFLAGS="$arch_flags" OBJCFLAGS="$arch_flags" OBJCXXFLAGS="$arch_flags" \
    --with-readline=builtin --with-gd=/usr/local/lib --with-png=/usr/local/lib \
    --with-plot=/usr/local/lib --x-includes=/usr/include/X11 \
    --x-libraries=/usr/X11/lib --with-lua --with-pdf=/usr/local/lib
    sudo make install
gnuplot will be compiled with the following terminals:

  Standalone terminals: yes (always builtin)
    canvas, cgm, corel, dumb, dxf, eepic, emf, emtex,
    epslatex, fig, gpic, hp2623a, hp2648, hpgl, imagen,
    latex, metafont, metapost, mif, pcl5, postscript, pslatex,
    pstex, pstricks, qms, regis, svg,
    tek40xx, tek410x, texdraw, tgif, tkcanvas, tpic, vttek

  dot-matrix terminals: yes (disable using --without-bitmap-terminals
    NB: copyright may restrict commercial use
    epson, nec, okidata, tandy, and seiko dp414 printers
    hp500c, hpdj, hpljii, hppj, pbm, starc

  X Window System terminal: yes
    (with multi-byte fonts)
    (enable plotting to windows opened by external apps) 
    (without binary polygon protocol )
    (with application defaults, in /etc/X11/app-defaults/)
  jpeg terminal: no (requires libgd with jpeg support)
  gif terminal: no (requires libgd with gif support)
  png terminal: no (requires libgd with png support)
    (jpeg, gif and png terminals cannot use TTF fonts, requires libgd support)
  pdf terminal: no (requires libpdf)
  plot library terminal: no (requires GNU plotutils or UNIX plot)
  linux terminal (vga console): no (use --with-linux-vga to enable,
                                       requires SVGAlib)
  vgagl terminal ((s)vga console): no (use --with-linux-vga to enable,
                                       requires SVGAlib with vgagl)
  ggi terminal: no (use --with-ggi to enable, requires libggi)
  mgr terminal: no (use --enable-mgr to enable, requires libpixrect)
  rgip/uniplex terminal: no (use --enable-rgip to enable)
  svga terminal (MSDOS/djgpp): no
  be terminal (BeOS): no
  next terminal: no
  aqua terminal (MacOS X): yes
  wxt terminal: no (requires C++, wxWidgets>2.6, cairo>0.9, pango>1.10)
  cairo-based terminals: no (requires cairo>1.2, pango>1.10)
  lua/TikZ terminal: yes 
  Qt terminal: no (requires C++, Qt >= 4.5)


gnuplot will be compiled with the following features:

  Mouse support in interactive terminals: yes
  Zooming or refresh of volatile data: yes (EXPERIMENTAL)
  Typing <space> in plot window raises console
  Command line macros: yes 
  Placement of rectangles and other objects: yes 

After the make process, we should get:

    test -z "BUILD_LUA" || lua ../../term/lua/gnuplot-tikz.lua style
    cp -p ./Gnuplot.app-defaults Gnuplot
    make[2]: Nothing to be done for `all-am'.

Finally, let’s consider those commands:

    set xrange [-2:2]
    set yrange [-2:2]
    splot exp(-x*x)*exp(-y*y)

My site is free of ads and trackers. Was this post helpful to you? Why not BuyMeACoffee


  1. gnuplot