Userfriendly it ain’t

It has long been accepted wisdom that these mouse-driven office “productivity” applications are in some way intrinsically more userfriendly than the command line or text file driven applications we are more accustomed to in Unix. Today I had the opportunity to prove to myself that this just isn’t the case.

I had a file containing two columns of data, first column is a date, the second column is a number. All I wanted to do was convert this into a nice graph with the dates on the X-axis and the numbers on the Y-axis. It seemed to me that this is exactly why spreadsheet applications like those provided in openoffice and gnumeric were designed. When it comes to office applications I am a novice but I do expect them to be usable with a bit of common sense and intuition. But, oh no, no matter what I tried I just could not get it to do what I wanted. First I had a huge battle to persuade it that the date column contained dates. Then I couldn’t get the chart style I wanted, once I decided to opt for what it thought best I then couldn’t easily label the axes, then I couldn’t easily add a title. After a long while of cursing and mouse-clicking I had a chart which more or less resembled what I wanted but could I print it?? Nope. It was spread horizontally across two pages so would not print out on one a4 sheet without a rotation but there was no obvious way to do a rotation. At this point I gave up…

A long time ago in a career far, far away I was an astronomer. You might think that most of what astronomers do involves looking through telescopes. The reality is a bit more dull, they spend their days sifting and analysing enormous amounts of data looking for the proverbial needle in a haystack. In those days the application of choice for plotting graphs was Super Mongo (or SM for short). This did a good job but it was a pig to use so I got into using a newer project named gnuplot, it was a bit limited in some places but the interface was so much nicer than SM it was generally the tool I used. Knowing what many astronomers are like they are probably still battling on with SM rather than try anything different and new but then they like using Fortran as well…

I’ve not used gnuplot in years so I had forgotten anything I ever knew about the syntax. However, having given up on the not-so-friendly spreadsheet I decided to give gnuplot a try. 5 minutes with a tutorial from IBM and the gnuplot manual and I had exactly the graph I had originally wanted with no cursing and swearing involved. Here’s the whole script:

set terminal png         # gnuplot recommends setting terminal before output
set output "report.png"  # The output filename; to be set after setting

set xlabel "Week"
set xdata time
set timefmt "%d/%m/%Y"
set format x "%d/%m/%y"
set xrange ["01/11/2007":"31/03/2009"]

set ylabel "Hours"
set yrange [0:25]

set boxwidth 3

plot "report.txt" using 1:2  with boxes lw 3 title 'Build Tools Project Effort'

It could be a lot simpler depending on the data, some of that gubbins is associated with making it parse and print dates correctly. This is stored in a file (e.g. report.gnuplot) and then passed to gnuplot on the command line:

$ gnuplot report.gnuplot

You now have a file named report.png. gnuplot also has a very nice interactive interface where you can type in your commands and try out stuff. It has also gained many features over the years and has some impressive abilities, it will also save to pretty much any file format you like which is perfect for inclusion in LaTeX docs or using in web pages. What’s not to like? It’s simple, straight forward and well documented. It’ll be a long time before I make another attempt to use a spreadsheet.

Comments are closed.