Skip navigation

  Help us to make more
useful things.
Donate to mySociety

Would you like to work with the team that built all these sites? We’re recruiting.

Gnuplot, Inkscape and SVG

Tuesday, February 21st, 2006 by Francis Irving

You’ve hopefully seen our WriteToThem.com 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.

5 Responses to “Gnuplot, Inkscape and SVG”

  1. Chris Lightfoot Says:

    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. Daniel Cassidy Says:

    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. Daniel Cassidy Says:

    Er, steps 3 and 4 above should be the other way round, of course :)

  4. K L Says:

    “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.

  5. Francis Irving Says:

    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.


News & information:
Projects:
Keep in touch:
Technical:

mySociety is a project of UK Citizens Online Democracy (UKCOD). UKCOD is a registered charity in England and Wales, no. 1076346. Its company number is 03277032, and mySociety Ltd's is 05798215.