Some xmgrace tips

Xmgrace is a very nice piece of software to create publication quality figures. Even better is that it stores your data and graph layout options as plain text (which is especially nice in combination with subversion or scripts to edit your graph).

But some things are not very intuitive, which is why I keep a list of some useful possibilities below:

  • Subscript, superscript
    x-squared: x\S2\N
    subscript: 3\s10\N
  • Greek letters, example: theta
    \f{Symbol}q\f{} or shorter: \xq\0q to get a theta symbol followed by the letter q: \x switches to the Symbol font and \0 switches back to Times-Roman.
  • Special symbols, example: Angstrom symbol
    For other characters, look at this list: ascii table with low and high characters. Just use the character from the left column between \c and \C to produce the one from the right column. I highlighted the most interesting characters (for a scientist). The \c and \C option are listed as deprecated in the xmgrace manual., but what is the new way?. The new method to insert special characters in xmgrace is:

    • Press ctrl-e while positioned in a text-edit field to bring up the font dialog box.
    • Select the desired font from the drop-down list. You probably want to use Symbol because it contains many of the commonly used special characters.
    • Click on the character you want to insert
  • Saving the default settings for new graphs:
    open xmgrace, make the desired settings, save them as:
    Unfortunately, this does not save the "print" settings, but see below.
  • Setting the default printer to print to .png files with 300dpi:
    create the file ~/.grace/gracerc.user and enter the following text:
    DEVICE "PNG" DPI 300
  • Changing the definition of the default colors:
    Just edit the lines that say
    @map color 7 to (220, 220, 220), "grey"
    in the saved file. Edit the default file (see above) if you wish to use the new colors everywhere from now on.

See also the Grace users guide and the grace forums.

If you have more helpful hints, please post them in the comments, so that this blog post will become an interesting collection of tips that can be turned into a useful "cheat sheet".

This entry was posted in linux, science. Bookmark the permalink.

55 Responses to Some xmgrace tips

  1. louic says:

    Here is a step-by-step guide:

    - Go to [Data] -> [Transformations] -> [Evaluate expression]
    - Select the source set (on the left) and destination (on the right) (you can select the same source and destination to change the data, or right click on the destination and select duplicate to copy the original set first)
    - Type "y = y * 10" and click [Accept]
    - That's all!

  2. Sudhir Kumar says:

    Dear users,
    i have a problem as follows:
    there are different symbol sets are available to represent the data set on x y plot.
    I wold like to represent our each data point by horizontal line instead of circle, cross, star , triangle etc.
    thanks in anticipation

  3. Maedeh Zahedifar says:

    Is there any body knows what is the symbol of root in Xmgrace?

  4. Madhu says:

    I have a problem I need help with.
    In labeling the graph axis, I do not know
    how to write a quantity with low and upper index as, for example :
    m_{tot}^{unit-cell}. The options I can use within xmgrace (i.e.
    m\stot\N\Sunit-cell puts the upper index at the point the lower index
    is terminated. Is it any other way to do this in a better way? Thanks.

  5. louic says:

    Hi Madhu,

    Starting with the basics, we get subscript and superscript, but the superscript is printed after the subcscript instead of on top:


    The solution is to apply a horizontal shift with \h{-0.8} before applying the superscript (you may have to adjust the -0.8 to fit your font size).


Leave a Reply

Your email address will not be published. Required fields are marked *