Inkscape and Grace oddities for science

Here’s a quick post about a couple of oddities and problems I encountered recently in Inkscape and Grace (on a Mac) in using them for preparing scientific plots. This kind of stuff isn’t especially well-documented online — it seems like people using these programs for this purpose often figure out a way that works for them and keep quiet about it. Also Grace in particular isn’t being developed at too fast a pace right now. Here we go:

  • Exporting an EPS (or PDF or SVG) from Grace and then importing the file into Inkscape results in the fonts being changed from Times (Grace’s default) to some horrible sans-serif font in Inkscape, and the spacing being all screwed up. As explained and solved here (in relation to Matlab) this happens because Inkscape can’t access the Times font used by Grace (although weirdly it knows `Times New Roman’ which looks the same). So when it looks for the font referred to in the PDF you imported from Grace, it can’t find it, and just fudges it. Using Fondu to create a version of Times that Inkscape can use solves the issue.
  • On Mac OS X Mavericks, installing Grace either via MacPorts or from source results in a couple of problems. 1) Thanks to updated Xcode tools, invalid arguments passed to the compiler generate an error not a warning and compile can fail. Apparently you can get around this by setting an environment variable, but it didn’t work for me. In Grace the problem is an `-m486′ flag which is passed to the compiler. I opened the configure script for Grace (or in MacPorts, the associated Portfile) and removed all mention of -m486 to stop this happening. 2) Once compiled, Grace on Mavericks seems to get a segmentation fault and crash on opening. This can be fixed in a hacky way by altering all mentions of the optimisation -O2 in the configure script to -O1. Or replacing a library helps to solve it properly, but I haven’t got round to that yet.
  • In Inkscape, copy and duplicate are different. If you create nice clean text or a nice clean line or circle etc, and then ctrl-c ctrl-v like usual, the pasted object no longer seems to be like a vector and will be fuzzy when you zoom in. I’ve no idea why this is but I’m sure there’s a good reason. Anyway, using ctrl-d to duplicate instead preserves the nice vectory sharpness of the original object. Given the amount of copying and pasting that goes on in making my scientific diagrams, this was quite important to find out. This seems to make it more difficult to copy an object between different files, since ctrl-c ctrl-v works (but looks crap) whereas I can’t currently find out how to `duplicate’ an object between files.
  • On opening an EPS or PDF you made with Inkscape at a later date in Inkscape, you may find that all the separate objects you had before behave as one object so it’s hard to remove or alter individual ones. You might end up using a nasty solution like a plain white box to block out bits you want to delete but can’t. This doesn’t seem to happen Inkscape’s native SVG format. If for whatever reason you don’t have the original SVG, sometimes it’s possible to select the single object in the imported EPS and then click `Object->Ungroup’. You can do this a few times to try and separate the different elements so they can be accessed one at a time. This is useful if e.g. you want to alter a figure somehow and don’t have the SVG.

I’m sure there will be experts who know more about these various issues — I’d be grateful for any more light shed. But hopefully someone who is experiencing any of these problems might find these quick and dirty solutions helpful sometime.


4 thoughts on “Inkscape and Grace oddities for science”

  1. I installed xmgrace on a brand new Mac Pro running 10.9.3 yesterday. It was about as painful as always. I never remember how to do it and I guess the path of least resistance changes over time. Anyway browsing through my history I think the following is what worked pretty much as advertised. First, install the Xcode common line tools from apple. Download the Macports pkg: from . Install Macports using the package. Then from the command line:

    sudo port selfupdate
    sudo port -f install openmotif
    sudo port -f install grace

    Hope this is useful to somebody!

  2. thanks for the reply John, that’s helpful. It seems like as scientists we often get quite attached to a particular plotting or graphics package once we’ve put in the trouble to figure it out, but can then fall foul of compatibility issues which are dealt with much more smoothly for more widely-used consumer programs.

  3. My general suggestion would be to just try and learn using Gnuplot. It’s much more actively developed and looks *so much better* than Grace. Grace seems more like a relic by now and there really is no point in keeping it around.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.