Xmgrace: A Quickstart

Xmgrace is a 2D plotting tool which allows you to interactively modify plots, to set all kind of plot parameters, change the appearance of your figure, and to save the figure in the format of your choice.

1. How to change the plotting region: The toolbar

The toolbar on the left-hand side of xmgrace allows you to quickly change the plotting region of your plot. It provides buttons for

  • zooming,
  • scrolling,
  • shifting the plot range,
  • autoscaling the whole plot or a single axis to contain all data points.

The most important functionalities of the toolbar are explained in the following graph.


2. How to change the axis properties: Labels, ticks, etc.

In order to change an axis's properties, just click on the axis and a menu will appear. The pop-up allows you to change the aspect of the chosen axis, i.e.

  • setting the plot range along this axis,
  • setting labels and changing their appearance,
  • setting tick marks, tick labels, and their appearance,
  • changing the appearance of the axis itself (linewidth, etc.).

3. How to add or change titles

Double-click on the region above the graph or open the menu Plot->Graph appearance. This will pop-up a menu which allows to set a title and a subtitle and to change their appearance (font size, etc. …).

4. How to add legends and change the appearance of the data sets/curves

In order to add a legend to a curve, double-click the curve and the Set Appearance dialog will pop up. In this dialog you can

  • add a legend to the data curves and change its appearance,
  • add the appearance of the curve (change the color, line style, thickness, etc.),
  • display data-points as symbols.

After entering one or more legends to data sets, they will appear as legend box in the window. The best way to shift the legend box is to press Ctrl+l, which will transform the mouse pointer into a hand and lets you move the legend box freely. To go back to normal mouse mode, click the right mouse button.

5. How to export graphics

In order to export the plot in your graphics format of choice, you need to do the following.

  1. Open the menu File -> Print setup. There you can choose the
    • desired graphics format in the Device pulldown,
    • the filename ,
    • confirm your changes with the Accept button.
  2. Open the menu File -> Print … this will save the file with the filename chosen above.

6. How to efficiently plot many data sets at once

We will explain how to do this using the following example: Assume you are in a directory workdir which contains 3 subdirectories
testdir-1, testdir-2, and testdir-3. Assume also that each subdirectory contains a file DATA.OUT. Then, if you want to plot all DATA.OUT files at once, you should

  • In the directory workdir, open xmgrace using the command
xmgrace  testdir-1/DATA.OUT testdir-2/DATA.OUT testdir-3/DATA.OUT
  • Click on any curve to open the Set Appearance menu.
  • To create legends automatically, within the Set Appearance menu
    1. select one set,
    2. press the keys Ctrl+a to select all sets,
    3. choose the menu Edit -> Load comments.

7. How to hide data sets/curves

In order to hide a data set/curve, double-click the curve and the Set Appearance dialog will pop up.

  • Select the data sets you want to hide,
  • Click the right mouse button … a new menu will pop up,
  • Select "Hide" in this menu.

To show a data set again, proceed as above, but at the end select "Show" instead of "Hide".

8. Further reading

Much more detailed information is found in the help menu or in the WEB.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License