Clustered Bar Graphs in Mac OS X
Nov 30, 2009 Latex, Visualization
I use gnuplot for most of my graphing needs, but using it for complicated bar charts has always been a pain. Fortunately, there is a very handy clustered/stacked bar chart generator which wraps gnuplot in a nice perl script to add some extra features. I’d used it previously under Linux without any problems, but to work on a Mac you need to first setup gnuplot (which can be a pain), plus you need the fig2dev utility to actually produce the final output files. Luckily, I found a copy of it compiled for OS X on the jfig webpage, and although it has a warning from 2006 that it may not work on Intel Macs, it works fine on mine. This will let you make eps/pdf versions of your graphs which will work nicely in latex documents.
Setting up Gnuplot on a Mac
Nov 29, 2009 Visualization
I wrote these directions down over a year ago, so they could be a bit out of date. I’d like a permanent record though since some of the steps are a bit tricky…
Gnuplot is used for making graphs. If you try to compile it normally you will get some errors. Here is how to make it work:
- Download and install aquaterm – this is a program which will handle the actual plotting graphics for gnuplot.
- Download the source code for gnpulot – I am using 4.2.3.
- Extract the source code somewhere (double click the file in finder or use “tar xzf FILENAME” from a terminal.
- Open a terminal and change to the extracted source directory.
- Configure the source code distribution by running: ./configure –with-readline=builtin You must use the –with-readline flag because Mac OS X comes with a bad version of this library. More details here.
- Build the source code by running make
- Install the resulting package by running make install
- You are done!
You can test it out by running gnuplot at the terminal and then typing plot sin(x)