Gnuplot, Inkscape and SVG

You’ve hopefully seen our 2005 Zeitgeist by now. Yesterday, Chris wrote up a useful description of confidence intervals, which I’d encourage you to read if you haven’t already. Just taking the mean of questionnaire responses like this is no good; it’s important to also look at how certain you are about the result.

While he was doing all that serious binomial bayes stuff, I had fun making pretty pictures. I used basically the same code as in the gnuplot tutorial which Chris gave me at the end of last year. Gnuplot remains lovely, however it produced pictures as ugly as this. If only there was built in anti-aliasing.

Chris tried to persuade me to tart them up using xfig, an old Unix diagram editor, but its interface was too much for me. Instead I exported as SVG and loaded them into Inkscape. It’s a lovely open source vector drawing package, available for Windows as well as the Linux that I use. I edited the colours and thickness of the graph line, and touched up the labels. However, I couldn’t work out how to easily reflect the tic marks on the axes so they face outwards. Here the text file format of SVG came to the rescue; I could edit the coordinates directly using vim.

After all this, the PNG file came out with a transparent background. Matthew spotted that this appears as grey on Internet Explorer, so I used Gimp to flatten it to a white layer behind.


  1. Had you used xfig, you’d have been able to reflect the tics and edit the saved file in your text editor, and with no ugly XML to get in your way. xfig, by the way, may not look pretty, but it’s extremely fast to use (modal, one-key command switching, etc.) and has the huge advantage over most other picture editors that it produces attractive TeX-compatible output (though to be fair that’s not relevant here).

  2. To reflect the tickmarks in Inkscape:

    1) Select all tickmarks at the bottom
    2) Flip the selection around the horizontal axis
    3) Bring up the align and distribute dialog (ctrl-shift-a)
    4) Group the selection
    5) Choose ‘relative to selection’
    6) Click ‘align tops of objects to bottom of anchor’
    7) Ungroup the tickmarks
    8) Repeat 1-7 for the tickmarks on the left and right, substituting the horizontal axis for the vertical axis, and ‘top’ and ‘bottom’ for ‘left’ and ‘right’

  3. “may not look pretty, but it’s extremely fast to use”

    But is it extremely *easy* to use? I’m guessing not. Interface design is very important.

  4. I found it (xfig) impossibly hard to use. But the reason for that is because it doesn’t follow various conventions which most Windows software follows, and which I’ve been used to for ten years. Enough for me not to be able to face learning it for a one-off job.