gnuplot is a widely used scientific plotting program from the unix world that is free and open source. It can produce most of the types of plots that a scientist might require on a dazzling array of output devices.
There are two main forms of gnuplot available for the Mac. There is a self-contained Carbon binary that may be your only choice if you are running a classic (pre-OS X) Macintosh system. This also runs on (at least some versions of) OS X, and may be convenient if you just need to see the output of a gnuplot command file, for instance, but don't need a permanent installation. This does not require X-Windows or any external viewer, and is easy to install, but it's not as good for external control (from gnuplot-py, etc.) as the standard gnuplot. However, this version has some unique features:
“gnuplot for Macintosh supports of number of Mac-specific technologies. In particular, gnuplot is AppleScriptable and recordable, supports PICT and QuickTime movie formats, incorporates a built-in gnuplot command file editor, and is drag-and-drop savvy. [....] it will run only on Mac OS 8.6 and above, must have Color Quickdraw, QuickTime, and CarbonLib 1.1 or above. The application has been tested under MacOS 9.0, MacOS 9.1, and MacOS X”
Download links for the carbon gnuplot have a history of appearing and disappearing; with the help of visitors to this page I'll try to keep a pointer here to a working link from a trustworthy source. If I list a link here that means that at least I have downloaded the program from that location and verified that it seems to work (on an OS X system). At the moment I know of no source for the Carbon gnuplot, and have not had any inquiries about it for over a year.
I recommend installing the traditional unix gnuplot for serious use on OSX. Since OSX is a unix system, any unix program that was written to be reasonably portable can be compiled to run on it. This includes programs such as gnuplot that, on traditional unix systems, produced graphical output with the X Window System, by installing a version of the X Window System on the Mac (or using the one that may be built-in). However, some graphical unix programs can be made to work with OSX's native display system (Aqua); gnuplot is one of these.
Compiling gnuplot to run on recent versions of OS X can be a problem, as Apple ships their system with various broken or outdated libraries. Your best bet may be either to use MacPorts, which is reported to work with OS X 10.7.x, or to install the binary Octave package, which includes a binary of gnuplot. To get this to work on OS X 10.7.3 or later, apply the fix described on that page. Octave is a very nice system that you might want to have anyway.
Another source for a slightly older binary of gnuplot is Maxima, the excellent open-source symbolic algebra system. Maxima has plotting built-in using gnuplot; binaries for OS X contain gnuplot binaries.
The official gnuplot v. 4.0 sources compile without modification on OS X, and there is also a binary available here for PPC macintoshes. This binary works on Intel Macintoshes as well, but sometimes refuses to run on recent installations. To get it to work, try the fixes described in the comments. It works with X11 or AquaTerm, and in fact requires the latter to be installed. The readme document that comes with the binary download claims that it will not run unless X11 is also installed, but this is not true; fortunately you can run this gnuplot without needing to install X Windows.
I suggest you read up on the new features in v.4.0, a major upgrade. One significant enhancement is the incorporation of the pm3d splot mode, which has been an unofficial part of gnuplot for some time. This lets you plot color-mapped surfaces.
You can get Aquaterm sources and binaries (which can be used with more than just gnuplot), here. This has also undergone a major revision, so if you have a version < 1.0 you should upgrade.
This binary seems to work fine on OSX 10.3.4 (Panther) on a couple of different G3 and G4 systems. I am interested in other's experiences with this software on a variety of configurations, and in any other relevant information. Please email me with any notes you think might be useful to others, and I'll include your comments here (tell me if you prefer to be anonymous). Note that the both official binary and the one that you can build from source do not include all the terminals that may be available on other systems; I have no information about this, but would welcome comments from readers who either know why or know how to get support for other output devices, as I sometimes get email asking about this.
The new version of Aquaterm seems to be faster than previous ones, so I've been using this now for moderately large 3d plots, which I had been doing with x11. You do get some mouse control with the x11 terminal, however, that you do not get with Aquaterm: you can rotate and scale 3d plots, and annotate and zoom 2d plots. To get a summary of interactive controls on your console, type “h” when the plot window has focus.
wxt terminal now works on “some flavors” of OS X.
wxt is an interactive terminal that works like the
x11 terminal, but does not require X windows and uses the
cairo library for superior drawing and text handling (it’s more capable
than Aquaterm).
file”, substituting your desired filename for
“file”. Then “replot”, and you’re done. To automate this, either use the
recently added iteration commands (see the manual) or control gnuplot
from python using gnuplot.py, etc.
Gnuplot tricks: Broken axis — Some Fun with GNUPLOT — Interesting 3d surfaces (but not much about gnuplot per se).
Gnuplot Tips (not so FAQ) — Very useful, well organized tutorial information in English and Japanese.
Ruby Gnuplot – “Ruby Gnuplot is a pipe-based interface to [...] gnuplot [...]. Through this interface almost every capability of gnuplot is useable from within Ruby.” (Ruby is an increasingly popular scripting language.)
Gnuplot Tricks — nice examples, some using new v. 4.4 features.
Examples of gnuplot in physics.
Comments
Comments are handled through email. Please send mail to _info_Macintosh_gnuplot.htm_comment@lee-phillips.org if you would like me to include it here. I will never expose your email address. Let me know if you want me to hide your name, as well.
Markian Hlynka reported that he was able to make a binary from the sources (that used to be) here, and that it works with Apple's current (2/21/03) X11 download.
Through his work he also discovered the need to include gnuplot_x11, and contributed other corrections to this page. Thanks!
From: Chuck Sindelar
Interesting - maybe I need to update it for more recent versions of Aquaterm. What version are you running?
My main suggestion is it would seem wonderful, and really easy, to include in your binary distribution the /usr/local/share/gnuplot.gih help file... I downloaded it separately myself, because I have found I can't really use gnuplot without it.
I'll consider this, or maybe including some pointers to documentation. I always just used the manuals on the web.
Thanks again for the work of distributing this binary!!
Chuck Sindela
LBNL postdoc
Thanks for your comments.
From: Chuck Sindelar
Chuck
From: Ragu_Bharadwaj
Subject: gnuplot download from web page Date: Thu, 24 Jun 2004
The gnuplot binaries are present for download as a pax.Z file. Since OSX doesn't come with cpio, is it possible to get it in a native Mac format?
cheers
-Ragu
My OSX (Panther) does come with cpio, but you don't have to use it. Instructions for unpacking the archives are on my gnuplot page. Perhaps you followed a direct link to the binary from some other website? Instead of linking directly to the download they should have linked to this page.
From: Philipp Robbel
Subject: gnuplot and aquaterm problem Date: Tue, 20 Jul 2004
- I ran pax as root as you describe on your website.
- I deleted the /usr/local/libexec directory with gnuplot_x11 in it since I did not plan to install X11.
- I downloaded aquaterm from the source forge website and from all the files that came with the distribution, I only moved AquaTerm.app to /Applications (I was no root anymore when i did this).
- I created a ~/.gnuplot file consisting of "set terminal aqua"
- I ran gnuplot and typed "plot sin(x)"
While the command seems to get through, no AquaTerm window pops up :-). Do you maybe konw if i was missing anything? Maybe setting an environment variable that points to /Applications/AquaTerm.app?
I am a bit lost and I would be _very_ grateful for your help.
Thank you!
Best,
Philipp
From: Philipp Robbel
Subject: gnuplot and aquaterm solution (kinda) :) Date: Tue, 20 Jul 2004
I did something really smart this time :) I went to the Applications folder and double clicked AquaTerm so that the program was already started up in the background. When I then ran gnuplot again and put "plot sin(x)" it works.
So the problem seems to be that gnuplot does not spawn a new instance of the AquaTerm application -- for me it only works if it is already running in the background.
Thanks for your time!
Regards,
Philipp
OK - glad it works. On my machines aquaterm will start up when I give gnuplot a plot command if it's not already running - weird.
From: Philipp Robbel
Subject: Re: gnuplot and aquaterm solution (kinda) :) Date: Tue, 20 Jul 2004
It seems that I had to start aquaterm manually _once_. Now it's spawning and everything works fine. Maybe aquaterm does some initialization when you start it manually for the first time? No idea but as long as it works now.... :)
Thanks again for your help!
Best!
Philipp
From: Richard Schmidt
Subject: aquaterm and gnuplot Date: Wed, 28 Jul 2004
I have just installed your binaries for gnuplot 4.0 on my PowerBook running 10.3.4. First, thanks for making the install easy and available. I have used gnuplot in X11 and with aquaterm before and have just installed it after a HD crash. All is well in X11. I downloaded the lastest aquaterm (1.0.a2) and I can get it to work but need to have aquaterm open (running) before I boot gnuplot in the terminal. Should gnuplot automatically open aquaterm for me? I also had to set the gnuterm environment variable manually in order for aqua to be set as the default terminal when I boot gnuplot. Do I not have something configured correctly? Thanks in advance for any help.
Richard Schmidt
See the comments from Philipp Robbel above, and my replies: that's all I know about having to have Aquaterm running! Does it start itself now that you've run it manually?
About having to tell gnuplot to use aquaterm: you have everything configured fine, most likely. This is normal: gnuplot doesn't know what terminal you want to use, so set the environment variable or just tell it "set term auqa n", where n is an optional number (that lets you control which Aquaterm window gets the plot).
From: Rob Frohne
Subject: Gnuplot.... Date: Tue, 21 Sep 2004
Thanks for putting the web page about Aquaterm and gnuplot on the web. I had it working in previous incarnations, but after updating everything in my fink archive (including gnuplot 3.8) I couldn't use Aquaterm anymore. With your binary for gnuplot 4, it works now again.
(Gnuplot was claiming I needed to update Aquaterm, but it seems that it needed to be updated instead.)
Thanks,
Rob
--
Rob Frohne, Ph.D., P.E.
E.F. Cross School of Engineering
Walla Walla College
From: Jiri Cech
Subject: Gnuplot for Mac Date: Wed, 15 Dec 2004
It is like a unix program: the binary is put in to /usr/local/bin, which is most probably on your path. Gnuplot is used from the command line just as in other unix systems. If you installed Aquaterm that goes in /Applications, and should start by itself when you issue a plot command if you have said "set term aqua" to gnuplot. If it does not start by itself then start it manually and try your plot command again (you may have to kill and restart gnuplot in this case).
Of course you can use x11 instead of Aquaterm.
I have found it most useful to add another layer on top of gnuplot rather than talking to it directly, using Gnuplot.py; other people write scripts in other languages.
Should I gave up and stick to something more graphical as xmgrace? Is there any origin replacement in the Mac/unix world???
I don't know about these, but I've been using gnuplot on OS X for all my graphing for a few years now.
From: Anthony Gray
Date: Tue, 18 Jan 2005 Subject: gnuplot and mac os x
First, thanks, of course. I know (I hope) you must get that a lot.
Next, this is probably obvious, but I seemed to need to restart my machine after upgrading to AquaTerm 1.0 b2 to get it to play nicely with gnuplot. Nothing in the upgrade for AquaTerm suggested this. Again, probably obvious.
[... later]
I am trying to compile gnuplot plus a couple of patches to enable histogram style stacked bar-chart support. [link added to list below]
[... and a bit later]
I downloaded new sources and new patches, paid close attention to permissions and such, recompiled, and it works. [...] I haven't done much with it yet, but so far the stacked bar-charts look pretty neat.
Wow, that's a great website - thank you for pointing that out. I think I might apply some of his patches myself. In the meantime, I'll add it to the list of links.
From: Thomas M. DeBoni
Subject: GNUPlot 4 under OS X Date: Fri, 4 Feb 2005
Thomas M. DeBoni
Lawrence Berkeley National Laboratory
Berkeley, CA
It works quite well on my crusty 450 MHz G4 work machine and my crustier 400 MHz G3 laptop at home, too. Glad it was of use to you, and make sure you have a recent Aquaterm if you are using that, as they made significant improvements a few months ago.
From: Thomas DeBoni
I should look in to that; you are the second person who has suggested it.
From: Thomas M. DeBoni
That's interesting; in the past I've noticed that x11 was faster for big 2d (contour, map) plots, but maybe the newer Aquaterm is faster. It certainly renders image maps (like those made with pm3d splot mode) better.
Thanks for your kind words, but all I do is compile the official sources on OS X. Aquaterm support is even built in now, so I don't need to edit the sources to get that (just install the Aquaterm library files before compling). I offer the binary to help people who don't have the developer tools installed or have had trouble finding the right sources or getting them to compile.
From: Del Marshall
Subject: gnuplot carbon Date: Fri, 11 Feb 2005
From: Carl Witthoft
Subject: gnuplot carbon found Date: Sat, 12 Feb 2005
I found version 3.7.1c at tucows, linked to [link added to page]
regards,
Carl
From: Byron Q. Desnoyers Winmill
Date: Sun, 13 Feb 2005 Subject: gnuplot for the Macintosh download
It is 3.7.1d
Byron.
Wow, three messages in three days pointing to locations for downloading the Carbon gnuplot! Using the information you provided as starting points, I'll try to maintain updated link information for the self-contained Carbon version.
From: Ryan Janzen
Date: Wed, 14 Feb 2007
Subject: [Gnuplot & Aquaterm] - Library Fix: 1.0.0 -> 1.0.1
I stumbled across your Aquaterm and Gnuplot website and downloaded the linked files. The latest version of Aquaterm is 1.0.1, whereas gnuplot is expecting 1.0.0. It is looking for /usr/local/lib/ libaquaterm.1.0.0.dylib but what Aquaterm installs is /usr/local/lib/ libaquaterm.1.0.1.dylib. A possible solution is to "sudo ln -s /usr/ local/lib/libaquaterm.1.0.1.dylib /usr/local/lib/libaquaterm. 1.0.0.dylib". It would be helpful to others if this is mentioned on your website. Other than that minor issue, it was very helpful.
Thank You,
Ryan Janzen
Subject: Gnuplot for MacOSX
I've been trying to install the latest gnuplot onto my Macs and am having problems. In the README.1st file, it says to copy the relevant makefile from config to src and the run the makefile in the src directory. Under the config directory, there's a MacOSX directory, and that ReadMe.rtf says that there is a gnuplot.pkg file to install. But, this file doesn't seem to be included in the download.
Thanks for your help,
Karen Edwards
I downloaded the 4.2.2 source package that you tried and you are right, there is no pkg file, but the reference to that seems to be an error in packaging; normally the pkg file is an installer that would come with a binary distribution, not a source distribution. To compile these sources you would follow the instructions for a unix platform (since OS X is unix). This will only work if you have Apple's Developer Tools installed, which includes the compiler. You type "./configure" in the gnuplot-4.2.2 directory, then "make", then, as root, "make install", usually. However, the compilation failed on my Mac just now; I'll have to figure out how to fix that some time later, when I have more time.
So if you really need version 4.2.2 I can't help you right now. However, you can get version 4.0, which I have and works fine. You can either download and compile the sources or, the easier route, just download the binary installer from the same download page:
http://sourceforge.net/project/showfiles.php?group_id=2055&package_id=1996
Just click the links for older releases until you see Gnuplot-4.0.0.dmg, download, and run the installer in the disk image. You will need Aquaterm, too, to run this gnuplot.
I hope this helps; let me know if there are any more problems.
From: Markian Hlynka
Date: Mon, 14 Jul 2008
Hi, Lee. I've been trying to install gnuplot on my new macbook pro. On 10.5 it doesn't seem to work. ie, the make fails. I believe I have found a solution here:
http://objectmix.com/graphics/344754-source-compilation-mac-os-x-10-5-leopard.html
However, I don't know what the ramifications are of doing: ./configure --with-readline=builtin. And I also don't know whether anything bad would happen with the first option, replacing libreadline. Since there were no instructions, I went with the second one.
Good to hear from you again. I don't have 10.5 installed, so have not yet tried to compile gnuplot on it. The official binary for PPC Macintosh, which is buried on the sourceforge page in the files for gnuplot v. 4.0.0, (it's the only .dmg download), is intended for PPC, but it still works fine on my current office Mac, which is an Intel running OS X 10.4.11. The download link is
http://downloads.sourceforge.net/gnuplot/Gnuplot-4.0.0.dmg
I don't know if this will work under OS X 10.5 with Apple's messed-up readline. Has anyone out there run this binary under OS X 10.5?
From: Bob Wonderly
Date: Sat, 29 Nov 2008
Subject: gnuplot on Mac OS X
Lee
Thanks to your web site info re gnuplot and comments by others I managed to install (and get it to work) gnuplot 4.2.4 on my Mac Book Pro running OS X 10.5.5 (all this on November 29, 2008).
Using your links I downloaded AquaTerm 1.0.1 and gnuplot-4.2.4
Then I ran:
./configure --without-readlinemake
sudo make install
Maybe this info can be of help to others.
From: Stefano Covino
Date: Sun, 25 Jan 2009
Subject: problems compilng gnuplot under mac osx 10.5.5
[Mr. Covino had problems compiling gnuplot, so I suggested he use the official OS X binary. It didn't work either on his system:]
I tried, but apparently this does not work as well.
This is the output:
[nexus:~] covino% gnuplot
dyld: Library not loaded: /usr/local/lib/libaquaterm.1.0.0.dylib
Referenced from: /usr/local/bin/gnuplot
Reason: image not found
Trace/BPT trap
try going into /usr/local/lib and looking at the files starting with "libaquaterm". The problem is likely to be that there is a symbolic link there that points to a nonexistent file, or that there is no libaquaterm.1.0.0.dylib. The relevant files in my /usr/local/lib are:
libaquaterm.1.0.0.dylib -> libaquaterm.1.0.1.dylib
libaquaterm.1.0.1.dylib -> /Library/Frameworks/AquaTerm.framework/Versions/A/AquaTerm
libaquaterm.dylib -> /Library/Frameworks/AquaTerm.framework/Versions/A/AquaTerm
From: Stefano Covino
Date: Mon, 26 Jan 2009
Subject: problems compilng gnuplot under mac osx 10.5.5
It works!
Now it is clear whay happened. I installed aquaterm v. 1.0.1 (I guess), but the binary look for v. 1.0.0. It was enough to create a symbolic link and everything seems to work fine.
Thank you a lot Lee. Perhaps it could be good to add the few lines you sent to me in the web page too.
Cheers,
Stefano
From: Karl Ihrig
Subject: zoom out in gnuplot command p
Date: Sun, 17 Jan 2010
Command-P zooms out in Gnuplot.
Karl
Thanks, Karl. I've figured out the interactive controls and updated the relevant paragraph.
Date: Sun, 22 Jul 2012
From: Joseph
I recently purchased your Gnuplot cookbook, just a few minutes ago actually, because I noticed that, among other things, it describes using Gnuplot with LaTeX. [...]
Thanks for your email. I hope you find my book useful; I have several examples of different ways to get gnuplot and LaTeX to work together.
So far, the only way that I've been able to get a plot from Gnuplot into a LaTeX document is by making it a .png from the png terminal, or an .eps from the postscript terminal, and using \includegraphics in my .tex file.
That works, of course, but does not get you the very best possible results.
I have not been able to get the .tex files made by the epslatex, latex, and pslatex terminals to typeset in TeXShop.
The only one of those that you probably want to use is the epslatex terminal. To start, try setting the terminal in gnuplot as
set term epslatex standaloneand, before plotting, set your output file. Try using math in the labels or title, using LaTeX syntax (and doubling the backslashes), like
set title "$\\sum_a^b f(x)$"Then process the output file that gnuplot creates in the usual way with pdflatex (or TeXShop). You should get a pdf with your plot and nice LaTeX labels. Look at the file to see how to include the plots in your own documents instead of using "standalone". Let me know if this doesn't work.
By the way, the following link on your website is dead - "LaTeX and the Gnuplot Plotting Program ? Using gnuplot with LaTeX: the latex terminal, EEPIC, and tikz with gnuplot 4.4"
Thanks for the tip.
Oh, and I've found the links on your website very useful, thank you!
You're welcome.
Lee