Xmgrace

Xmgrace

We will not go into all the details, just some of the basics for you to get started. We primarily use Xmgrace to create figures from raw data and then saved into .eps file format that we then polish with Adobe Illustrator.

Start-up

  1. To run xmgrace you need to pull up a bash shell and then run the command:
    • $ xmgrace
  2. Load-in the parameter file the Dr. Knotts gave you. These are basic settings for figures our group uses. You'll obviously change some of them for your specific case, but this is a good starting point and you don't have to worry about all the less-used parameters.
    • Plot > Load Parameters In the GUI you will need to type file path where you have your .par file in the "Filter" box. You can also double click directories in the "Directory" box to navigate your file system. Select the .par file you want to apply in the "File" box and hit "Apply".
  3. Read-in your .dat or .txt file with only the data you want to plot.
    • Data > Import > ASCII This will pull up a GUI. Select the file in a similar manner as your parameter file. If you are loading a .txt file you will probably want to view all files in your directory. To do this remove the *.dat modifier in the "Filter" box and then click the "Filter" button. Once you have your file selected you can select one of 3 "Load as" options.
      • Single Set. Use this option if you only have XY data in your .txt file. If you do have multiple columns column 1 will be your x data and column 2 will be your y data.
      • NXY. Use this if your .txt file has multiple sets of data and you only want to grab all columns of data, column 1 is your x data and the other columns are your y data. Cannot be used if any strings are present in your .txt file.
      • Block Data. Use if you want to only extract certain columns from your .txt file. selecting this will open a GUI and you indicate what column you want as your x and what columns you want as your y. Cannot be used if any strings are present in your .txt file.
    • Note: If you want to load in a large data set you need to increase the number of data points you can manipulate.
      • Go to Edit > Preferences and a preferences GUI will pop-up
      • Increase the "Max drawing path length to the number of data points you want to plot. I have uploaded data points 300000+ w/o any issue.
  4. Modifying your graph is done by selecting the field you want to edit. Selection is done by double clicking that part of the graph and a GUI will pop-up and you will then manipulate things from there.
  5. To edit data, double click the data lines/values then navigate the GUI and select/highlight the data range you want to change.
  6. To edit axis, double click on the axis line, not the tick marks or tick values
  7. For basic graph data like title and graph appearance, double click the whitespace above the center of the graph or the legend if you have one.
  8. Saving your session is not very intuitive.
    • File > Save As This will pull up the Save GUI. Navigate to your desired directory as before. You don't need a "Project Description." Type the name you want your project to be saved in the "Selection" section. You will need to include the xmgrace file type (.agr) in your save name, though in all honesty your just saving a text file with the graph's preferences indicated in it.
  9. The auto-rescale button is in the main figure viewer on the left side. It is a blueish button with the letters AS on it.

Saving/Printing Different Picture Formats

For publication quality figures we want to create figures in the .eps format and these figures are outlined below. For normal pictures you can save as .png if you want, just modify the procedure appropriately. For simplicity saving the figure in any format besides a .agr format we will call saving a picture. Saving a picture is called "printing" in xmgrace.

  1. We first need to tell xmgrace how to and in what format to print the picture.
    • File > Print setup
  2. In the Device setup field; select the Device drop-down and choose EPS.
  3. In the Output field; Choose the right filepath and name for your figure. Make sure to include the .eps file type in the name.
  4. All other options should be good. Change if needed.
  5. Click Apply and Accept
  6. Print the Figure
    • File > Print

Edit Data GUI

After you have loaded-in your data you can change how the data is presented. To open the data edit GUI double click on any data in the figure or Plot > Set Appearances

  • In the "Select Set:" field:
    • Single click to modify this set's display properties
    • Double click open another GUI that lets you directly modify/add/delete the actual data values.
    • Duplication, inactivation, deleting and other functions for entire data sets can be applied by right clicking the data sets in this field and then choosing the option you want to apply.
  • In the "Main" tab:
    • "Symbol Properties" determines the data symbol's outline style, color and size. I do not know what "Symbol Char" means
    • "Line Properties" determines the data line's style, color and width. The line type should be straight unless you have a specific need.
    • "Legend" is default off unless you populate this field. This is the text that will be displayed in the legend. To edit the legend properties, double click it and navigate the the legend tab in the "Graph Appearance" GUI.
  • In the "Symbols" tab:
    • Fairly straight forward though make sure to select a pattern for both outline and fill.
    • A single data set maintains all the same properties. For example, if you want to change the color of a single data point it will need to be in its own data set.
  • In the "Line" tab:
    • Fairly straight forward too. Note pattern in this filed is different than style in the "Main" tab.

Edit Axes GUI

You can change your axis properties at anytime. When you load-in data your axis values will automatically shift to include all new data. To open this GUI, double click on the axis line, not a tick mark or axis value or Plot > Axis properties

  • You can change between all your axis by clicking the drop-down menu at the top of the GUI and choosing the axis you want to edit.
  • You can manually change the axis bounds and the scale (linear, logarithmic, etc.) at the top of the GUI.
  • In the "Main" tab:
    • Axis label is default-off unless you populate this field. To edit the look of this navigate to the "Axis label & bar" tab within this GUI.
    • Tick properties field changes the spacing of major and minor ticks. Major spacing puts ticks on number values spaced as inputted starting at 0, not starting at your axis "Start" value.
    • Minor tick is an integers which indicates how many minor ticks you want in between your major ticks.
    • Tick format changes the format of the numbers written at each major tick.
  • In the "Axis label & bar" and the "Tick labels" tab:
    • Basic formatting for the style you want for your axis/tick label.
    • The Char size slider can be moved with your mouse, or if you click it, you can then do fine adjustments with the left/right arrow keys.
  • In the "Tick marks" tab:
    • The Placement field has basic formatting and is straight forward
    • Within the Placement field there is a box to check "Place at rounded positions" if unchecked, major spacing puts ticks on number values spaced as inputted starting at your axis "Start" value, not starting at 0.
    • Further formatting can also change tick size, style, etc.
  • You can manually insert additional or edit specific ticks in the "Special" tab.

Edit Graph Appearance GUI

You can edit your graph appearance anytime. To open this GUI, double click on the area above the graph or anywhere within your legend or Plot > Graph appearances. As this page only goes over basic xmgrace functionality we will not cover all the things you can do within the "Graph" field. We will only talk about thing you can do within the tabs.

  • In the "Main" tab:
    • Change the graph type to bar, pie or other types of charges in the "Presentation" section
    • Figure titles are default-off unless you populate these fields. To edit the look of these, navigate to the "Titles" tab within this GUI.
    • The "Viewpoint" field shifts the size of the graph, so if you have axis labels that are cot off or the whitespace to too large, change the min/max values in this field.
  • In the "Leg. box" tab:
    • The location field tells you where to put the legend where the x coordinate is the left side of the legend and the y coordinate is the top of the legend; namely the top left corner of the legend will be the coordinates you input into the X: and Y: fields.
    • Viewpoint coordinates are the coordinates of your graph in the scope of all whitespace seen where the default size of your graph is always 1x1, but the param file we loaded in earlier makes this to be about 1.3x1. This legend will not move if you change axis ranges.
    • World coordinates are in the scale and location of your figure's axis. You can see the world coordinates of your cursor in your figure in the upper left of xmgrace just below the "File", "Edit", and "Data" buttons of your window. This legend will move if you change axis ranges.
    • Frame line and frame fill are fairly straight-froward.
  • In the "Legends" tab:
    • Text properties field is intuitive
    • The Placement field has V-gap and H-gap which stand for vertical gap and horizontal gap, respectively. The is the vertical and horizontal gaps between the legend elements.
    • The Legend line length is the distance between the left line of the legend and the indicator symbol and the distance between the indicator symbol and the description. Shouldn't really need to change this.

Symbols and Characters

These characters can be inputted into titles, labels, legends and other fields that take text to be displayed. To access different alphabets you have to switch into that keyboard.

  • \f{} To return to normal/original font
  • \N To return to the text to default state/keyboard
  • \x To enter the Greek character keyboard. Once in this keyboard, letters will then be their greek counterpart. For capital case greek letters, use the capital letter. Some common greek letters:
    • a=alpha, b=beta, d=delta, e=epsilon, f=phi, l=lambda, m=mu, p=pi, q=theta, r=rho, s=sigma, w=omega, y=psi
    • For more greek letters see: XMGrace Cheat Sheet
  • \S To enter superscript mode. Use \N to return to default keyboard.
    • to type x squared, type: x\S2\N
  • \s To enter subscript mode. Use \N to return to default keyboard.
    • to type x sub 1, type: x\s1\N
  • \c To enter the "upper 128 characters of a set" (whatever that means...) and \C removes you from it. Some important symbols:
    • \cE\C to type just the angstrom symbol
    • \c 0\C to type the degree symbol
  • \x\c puts you into the symbol font and upper 128 set of characters. \C\f{} gets you back to normal keyboard. Some important characters in this set are:
    • \x\c%\C\f{} = infinity
    • \x\c1\C\f{} = +/- symbol
    • \x\c7\C\f{} = the dot multiplication symbol
    • \x\c3\C\f{} = greater than or equal to symbol
    • \x\c#\C\f{} = less than or equal to
    • \x\c9\C\f{} = not equal
    • \x\ce\C\f{} = summation
    • \x\cr\C\f{} = integral
    • \x\cQ\C\f{} = gradient symbol (upside down Delta)
    • \x\c;\C\f{} = approx. equal
    • \x\c.\C\f{} = arrow ->
    • \x\c^\C\f{} = arrow =>

Histograms

The method outlined here assumes you have clean start of xmgrace. You will need to modify the procedure a little if you have previous figures and data uploaded into the program.

  1. Open xmgrace and load your data like normal. You will have a line graph like normal.
  2. Bin the data and plot a histogram by first opening the histogram GUI: Data > Transformations > Histograms
  3. In the "Source" field, "Set:" section; duplicate the G0.S0 data set by right-click -> duplication; make sure G0.S0 is seleted.
  4. In the "Destination" field, "Set:" section; select the G0.S1 data set. This is the data set you just duplicated in the last step.
  5. Set the parameters of the histogram:
    • "Start at:" is the lowest value bin, this is not inferred by xmgrace
    • "End at:" is the highest value bin, this is not inferred by xmgrace
    • # of bins is the total number of bins you want. xmgrace will calculate, based on your given range, the bin length.
  6. Click "Apply"
  7. The histogram is plotted, but we need to hide the previous plot and rescale the plot
    • To hide the line plot, in the Source field in the Set: section; right-click -> hide
    • Click the blue AS (auto rescale) button in the main graph viewer. To manually rescale and get a rough idea of the range, open the edit data GUI and then double click your histogram data (G0.S1) where another GUI will open and a table of your bins and bin values will be listed; rescale in your Edit Axis GUI according to these values.