My son and I use gnuplotfor all our graph plotting, because it is free, it has good curve-fitting tools, it can produce graphs in many standard graphical formats (both vector and raster formats), and it has good scripting capabilities.
I sure wish that it came already installed on Macintosh computers, though, as it is huge pain to install. We had to install it for my son to do his latest physics lab writeup, as the old version we had on the household computer was from the old G5 iMac, and could not run under Lion, which no longer supports emulation of the PowerPC processors.
Probably the easiest way to install gnuplot is using MacPorts, so first we had to install MacPorts. Downloading it went fine, but it wouldn’t install, because the Xcode that came with the Mac was not suitably configured. So we had to install a new Xcode, which meant setting up an AppStore account. The Xcode download is almost 2 Gbytes and took an hour. What the h*** is in Xcode that it is so bloated? So far as I can see, Xcode contains a low-quality editor (about as powerful as Textedit), some compilers, and a build system that is about as featureful as make. The download is about 100× bigger than is reasonable—is it full of porn videos or what?
After the hour-long download of Xcode, MacPorts installed ok, but to run it we had to add /opt/local/bin and /opt/local/sbin to the path in the .cshrc file (and /opt/local/man to the MANPATH), since MacPorts puts its programs in a totally separate place form where everything else gets installed.
Because my son wanted to use the latest features of gnuplot (the pdfcairo output option), we started by using
sudo port install cairo sudo port install pango
This triggered a huge pile of downloads and installations, as MacPorts built an entire ecosystem duplicating most of the compilation and building capabilities of Xcode (so why does it need Xcode to get started). After about an hour of downloads and building, we were finally ready to install gnuplot.
Due to lack of documentation for Mac installation on the gnuplot site, we downloaded and installed gd-libgd, which probably was not necessary, because
sudo port install gnuplot
installed a different version of gd anyway. The total time to do the installation was over 2 hours (mostly due to the massive downloads). It also took up a huge amount of disk space (1.9Gbytes for Xcode, 769Mbytes in /opt). All that for a tiny program that is only about 2Mbytes. I just wanted one small graphing program, not two huge ecosystems for developing code!
There are two groups of people who could fix this problem:
- Apple could include gnuplot in their standard Unix utilities. This would be the simplest and best solution.
- The gnuplot developers could release Macintosh binaries (like they already do for Windows) that install like other Macintosh programs.
I’m not going to hold my breath waiting for either of these things to happen. Apple has no interest whatsoever in the scientific market (though I see more and more MacBooks at conferences) and the gnuplot developers see nothing wrong in taking 2 hours and 2.7Gbytes to install a 2Mbyte program—they do it all the time.
I used to recommend gnuplot to my students all the time, but now that most of them have Macs, I can’t honestly recommend it anymore. No one should have to go through that much hassle to install a simple program.
[Added 2013 March 15: Read through all the comments. Gnuplot installation on Macs has gotten somewhat easier since I wrote this post, and people have written about better approaches in the comments. Installation is still not as easy as it should be, but it is not quite the nightmare it was.]
[Update 2016 Nov 20: I installed gnuplot on a MacBook Air by
- Installing Xquartz from https://www.xquartz.org/
- Installing brew from http://brew.sh/ The command given on their homepage has to be run from bash, not tcsh.
- brew install gnuplot --with-cairo --with-x11 --with-qt5
Note that this set of commands provides pdf output with the “pdfcairo” terminal, but not the “pdf” terminal. The default is the qt5 terminal, though I think I prefer the classic x11 terminal, because of my familiarity with it. (Switching with “set term x11” is easy enough.)