Grace Tutorials

Edward Vigmond evigmon@tulane.edu

for Grace-5.1.4

1. Introduction

2. Making a Simple Graph

3. Block Data

4. Creating sets within Grace

5. Batch plotting

6. Fitting curves

7. Transformations

8. Using Pipes

9. Multiple Graphs

10. Hot Links


1. Introduction

These tutorials assumes that you are a new user to Grace but are somewhat familiar with a windowing system. They are designed to show you some of the basic operation of Grace as well as a few of its less intuitive features. Please feel free to go beyond the bounds of the actions described herein and explore the possibilities of using Grace. After all, you will be the one who benefits.

1.1 Purpose

The purpose of these tutorials are to give brief examples to show you the basics of how to do something. Essentials and some of the more esoteric features of Grace will be demonstrated to give the user an idea of the capabilities of this program. It is not possible to show everything that Grace is capable of doing. That knowledge only comes with use and experimentation. I recommend that you do the tutorial and then by playing around with things, you will begin to understand them. Finally, when you get stuck, read the user guide to help you.

1.2 Nomenclature

In referring to what item to select, the tutorial will use something of the form snaf:/foo/bar/bell which means that on the snaf popup, select from the foo menu the submenu bar and from the bar menu, the entry bell. The popup main is the large one with the graph that pops up when you run xmgrace. If there is a space in the menu item, it will be replaced by an underscore. So , if the menu item was actually "Bell jar" instead of bell in the last example, it would be snaf:/foo/bar/Bell_jar.

Things that are to be typed in will be presented in a typewriter font, eg, type y = 3*sin(x).

Some of examples require you to input a data file or graph. In such instances, there should be a file in the tutorial directory named data.N or N.agr where N is the tutorial number. For example, when doing tutorial 7.1.3, you should look for a file 7.1.3.agr. It is assumed that each major tutorial section starts with a clean graph.

1.3 Computer System

Some of the following examples require that system commands be run. The commands may be different on your machine or require a slightly different syntax. In this tutorial, an attempt will be made to use the most commonly available UNIX commands. This tutorial was prepared on a Linux machine with kernel 2.0.32.

1.4 Generalities

A couple of points should be made about the GUI before we begin to make life easier.

  1. It is often possible to select more than one item from a list at a time (some lists may prevent it when it makes no sense.). Clicking on a list entry without any keyboard modifier pressed will deselect all other entries and select only that one. Depressing shift while clicking an entry selects all entries from a previously selected entry to the currently selected one. Finally, depressing control allows one to individually toggle the selection of an entry.
  2. There are often two buttons on a pop up: Apply and Accept. Changes are not registered until either of these buttons is pressed. The difference between them is that Accept also closes the window.

1.5 Disclaimer

Even though I do my best to keep this up to date with the latest release, I cannot guarantee it. Think of this a perpetual work in progress. Therefore, if something is wrong, you can notify me and I'll fix it but keep in mind that I am doing it in my spare time for no money.

2. Making a Simple Graph

The object of this tutorial is to do the most basic function of Grace: read in some data into a graph and then label the graph. Along the way, a few of the basic Grace commands and widgets will be introduced.

2.1 Reading the data from a file

Start by bringing up the set reading widget Main:Data/Import/ASCII. Select the file 2.1.dat (both double clicking and hitting return work). You should see a black curve drawn on a graph.

Now we would like to add some more sets to the graph, but this time the data file will be in a slightly different format. Looking at the file "2.1.dat" (with the program of your choice), you can see that its several columns of numbers. One way to interpret this file is the first column gives the x-values and the rest of the columns are y-values. From Grace, again open the "Read Sets" widget. This time, check the "NXY" button. Now select the file "2.1.dat". At this point you will have several differently coloured curves.

You should now have 2 copies of the first set since you've read the file twice. It would be nice to eliminate one copy. This is most easily accomplished by bringing up a popup which lists all the sets. Selecting Main:Edit/Data_sets...bring up the Data set props popup. It lists all the sets and for the selected set, its type and a few statistics. To eliminate a set, select it and then press the right mouse button. A menu should appear from which you can select kill. You'll note that there is a kill and kill data. The former totally eliminates everything associated with a set while the latter eliminates the data but keeps the settings for it so that if new data is read into the set, it will have the same properties like colouring and line width, etc. Kill set 0 for now.

2.2 Set appearance

We would now like style the sets. Practically all aspects of the curves are configurable including colour, line thickness, symbols, drop lines, fills, etc. These operations are available under the "Set appearance" widget which is invoked by selecting Main:Plot/Set appearance... or by double clicking near the target set within the graph frame.

When the widget comes up, there will be a list of the sets with their number (eg. G0.S1 refers to set 1 in graph 0). Later operations will require you to know the number. Like the data sets pop up, clicking on mouse button 3 in the set list will bring up the menu of set operations.

Colouring all sets differently

The simplest way to colour all sets differently is from Set_Appearance:Data/All colors. First select the sets which you wish to recolour and then select Set_Appearance:Data/All colors. Do this now to your graph.

Customizing each set

When a set in the list is highlighted, the widgets change to reflect the settings. Practically all aspects are configurable. Experiment by changing the line colours and widths, placing a symbol at each data point, not connecting data points and fill the space between the x-axis and the curve. Don't forget to try out what is available under the other tabs besides Main. To see the effect of a change, you have to hit the "Apply" button. N.B.: Things are drawn in numerical order so if there is overlap, the highest numbered item will be on top. This applies to graphs and sets within each graph.

2.3 Labelling the axes using the font tool

Aspects of the axes are controlled by the axes popup which is called from Main:Plot/Axis properties or by double clicking the graph frame. All aspects of the axes can be changed like the title, the font, colour, whether or not to draw grid lines, or user defined tick marks and labels. There are many settings and the best thing to do is to experiment to see what each setting does.

For now, let's start by labelling the axes. Suppose these curves represent the number of tasks a processor runs as the function of the number of users. To make it more interesting, assume we are doing this in Quebec. That means we want to plot "Nombre de tāches vs. nombre d'usagers". Note the importance of having the accent over the a in tāches or we would end up plotting the number of stains which is entirely another case. Bring up the Axes pop up, select the Y axis, and click in the space to enter the label string of the axis label. Start typing Nombre de t. At this point we need to enter a accented letter, so we bring up the font tool by pressing Control-E. You will now see what we have typed in the Cstring widget. Move the cursor to where you want to place the accented letter and click on the letter. It should now appear in the string. You can either finish the string here or hit accept and keep editing. Label the x axis as well. This font tool is available wherever text needs to be entered.

All the attributes regarding the axis labels like size, colour, font, position are changeable.

2.4 Graph titles

Our next exercise will be to title the graph so other. Operation pertaining to this are found in the "Graph appearance" widget which we open by selecting Main:Plot/Graph appearance or by double clicking just above the graph frame.

We can now fill in the title of the graph and by clicking on the "Titles" tab, the font and size and colour can be chosen. The Viewport box under the "Main" tab defines the 4 corners of the graph frame. You can type them in or use the mouse to move them by first double clicking on them.

Other things which can be controlled in this widget are the frame drawn around the graph, whether or not the graph background is coloured and the legends. Legends will be dealt with a little later.

2.5 Legends

Since we have several lines in our graph, it makes sense that we label them with a legend so that other people can figure out what they mean. The first thing to do is to give each set a label. This is done by entering a legend string for each set in the Set appearance popup. Now, from the Main form in the Graph appearance popup, click on "Display legend" to see the legend box. The location and appearance of the box is controlled by clicking on the "Leg. box" tab. The appearance and spacing of the legend entries is controlled by the "Legends" tab. For simplicity, label the sets alphabetically and then play with the appearance, etc. to get something you like.

Specifying the placement of the graph by entering the coordinates can be painful, especially the fine tuning. To alleviate this problem, a graphical method is also available, although not readily apparent. After a legend appears, it may be dragged to a new location. To do this, press Ctrl-L with your mouse on the main canvas. You should see the arrow cursor turn into a hand. If this doesn't work, double click on the main canvas (to get its attention) and then press Ctrl-L. Click on the legend and drag it. To cancel the legend drag mode (as with all other modes), click on mouse button 3.

2.6 A challenge

I got bored so I took the data files and produced my own, albeit ugly, graph. See if you can copy mygraph.png

3. Block Data

A block of data is a table of number which are interpreted as columns of numbers. How sets are created from the columns depends on the information you want to extract from the file.

We first need to read in a block of data. We do this from Main:Data/Import/ASCII. Select the file "3.dat" and Load as "Block data". If the read was successful, a window should pop up asking you to create a set from the block data. At the top it will list how many columns of data were read.

First we choose the type of set we would like. For now we'll stick with xy.

Next we choose which column of data contains the x-ordinate. If theraphicGraph

The object of this tutorial is to do the most basic function of Grace: read in some data into a graph and then label the graph. Along the way, a few of the basic Grace commands and widgets will be introduced.

2.1 Reading the data from a file

Start by bringing up the set reading widget Main:Data/Import/ASCII. Select the file 2.1.dat (both double clicking and hitting return work). You should see a black curve drawn on a graph.

Now we would like to add some more sets to the graph, but this time the data file will be in a slightly different format. Looking at the file "2.1.dat" (with the program of your choice), you can see that its several columns of numbers. One way to interpret this file is the first column gives the x-values and the rest of the columns are y-values. From Grace, again open the "Read Sets" widget. This time, check the "NXY" button. Now select the file "2.1.dat". At this point you will have several differently coloured curves.

You should now have 2 copies of the first set since you've read the file twice. It would be nice to eliminate one copy. This is most easily accomplished by bringing up a popup which lists all the sets. Selecting Main:Edit/Data_sets...bring up the Data set props popup. It lists all the sets and for the selected set, its type and a few statistics. To eliminate a set, select it and then press the right mouse button. A menu should appear from which you can select kill. You'll note that there is a kill and kill data. The former totally eliminates everything associated with a set while the latter eliminates the data but keeps the settings for it so that if new data is read into the set, it will have the same properties like colouring and line width, etc. Kill set 0 for now.

2.2 Set appearance

We would now like style the sets. Practically all aspects of the curves are configurable including colour, line thickness, symbols, drop lines, fills, etc. These operations are available under the "Set appearance" widget which is invoked by selecting Main:Plot/Set appearance... or by double clicking near the target set within the graph frame.

When the widget comes up, there will be a list of the sets with their number (eg. G0.S1 refers to set 1 in graph 0). Later operations will require you to know the number. Like the data sets pop up, clicking on mouse button 3 in the set list will bring up the menu of set operations.

Colouring all sets differently

The simplest way to colour all sets differently is from Set_Appearance:Data/All colors. First select the sets which you wish to recolour and then select Set_Appearance:Data/All colors. Do this now to your graph.

Customizing each set

When a set in the list is highlighted, the widgets change to reflect the settings. Practically all aspects are configurable. Experiment by changing the line colours and widths, placing a symbol at each data point, not connecting data points and fill the space between the x-axis and the curve. Don't forget to try out what is available under the other tabs besides Main. To see the effect of a change, you have to hit the "Apply" button. N.B.: Things are drawn in numerical order so if there is overlap, the highest numbered item will be on top. This applies to graphs and sets within each graph.

2.3 Labelling the axes using the font tool

Aspects of the axes are controlled by the axes popup which is called from Main:Plot/Axis properties or by double clicking the graph frame. All aspects of the axes can be changed like the title, the font, colour, whether or not to draw grid lines, or user defined tick marks and labels. There are many settings and the best thing to do is to experiment to see what each setting does.

For now, let's start by labelling the axes. Suppose these curves represent the number of tasks a processor runs as the function of the number of users. To make it more interesting, assume we are doing this in Quebec. That means we want to plot "Nombre de tāches vs. nombre d'usagers". Note the importance of having the accent over the a in tāches or we would end up plotting the number of stains which is entirely another case. Bring up the Axes pop up, select the Y axis, and click in the space to enter the label string of the axis label. Start typing Nombre de t. At this point we need to enter a accented letter, so we bring up the font tool by pressing Control-E. You will now see what we have typed in the Cstring widget. Move the cursor to where you want to place the accented letter and click on the letter. It should now appear in the string. You can either finish the string here or hit accept and keep editing. Label the x axis as well. This font tool is available wherever text needs to be entered.

All the attributes regarding the axis labels like size, colour, font, position are changeable.

2.4 Graph titles

Our next exercise will be to title the graph so other. Operation pertaining to this are found in the "Graph appearance" widget which we open by selecting Main:Plot/Graph appearance or by double clicking just above the graph frame.

We can now fill in the title of the graph and by clicking on the "Titles" tab, the font and size and colour can be chosen. The Viewport box under the "Main" tab defines the 4 corners of the graph frame. You can type them in or use the mouse to move them by first double clicking on them.

Other things which can be controlled in this widget are the frame drawn around the graph, whether or not the graph background is coloured and the legends. Legends will be dealt with a little later.

2.5 Legends

Since we have several lines in our graph, it makes sense that we label them with a legend so that other people can figure out what they mean. The first thing to do is to give each set a label. This is done by entering a legend string for each set in the Set appearance popup. Now, from the Main form in the Graph appearance popup, click on "Display legend" to see the legend box. The location and appearance of the box is controlled by clicking on the "Leg. box" tab. The appearance and spacing of the legend entries is controlled by the "Legends" tab. For simplicity, label the sets alphabetically and then play with the appearance, etc. to get something you like.

Specifying the placement of the graph by entering the coordinates can be painful, especially the fine tuning. To alleviate this problem, a graphical method is also available, although not readily apparent. After a legend appears, it may be dragged to a new location. To do this, press Ctrl-L with your mouse on the main canvas. You should see the arrow cursor turn into a hand. If this doesn't work, double click on the main canvas (to get its attention) and then press Ctrl-L. Click on the legend and drag it. To cancel the legend drag mode (as with all other modes), click on mouse button 3.

2.6 A challenge

I got bored so I took the data files and produced my own, albeit ugly, graph. See if you can copy mygraph.png

3. Block Data

A block of data is a table of number which are interpreted as columns of numbers. How sets are created from the columns depends on the information you want to extract from the file.

We first need to read in a block of data. We do this from Main:Data/Import/ASCII. Select the file "3.dat" and Load as "Block data". If the read was successful, a window should pop up asking you to create a set from the block data. At the top it will list how many columns of data were read.

First we choose the type of set we would like. For now we'll stick with xy.

Next we choose which column of data contains the x-ordinate. If theraphicGraph

The object of this tutorial is to do the most basic function of Grace: read in some data into a graph and then label the graph. Along the way, a few of the basic Grace commands and widgets will be introduced.

2.1 Reading the data from a file

Start by bringing up the set reading widget Main:Data/Import/ASCII. Select the file 2.1.dat (both double clicking and hitting return work). You should see a black curve drawn on a graph.

Now we would like to add some more sets to the graph, but this time the data file will be in a slightly different format. Looking at the file "2.1.dat" (with the program of your choice), you can see that its several columns of numbers. One way to interpret this file is the first column gives the x-values and the rest of the columns are y-values. From Grace, again open the "Read Sets" widget. This time, check the "NXY" button. Now select the file "2.1.dat". At this point you will have several differently coloured curves.

You should now have 2 copies of the first set since you've read the file twice. It would be nice to eliminate one copy. This is most easily accomplished by bringing up a popup which lists all the sets. Selecting Main:Edit/Data_sets...bring up the Data set props popup. It lists all the sets and for the selected set, its type and a few statistics. To eliminate a set, select it and then press the right mouse button. A menu should appear from which you can select kill. You'll note that there is a kill and kill data. The former totally eliminates everything associated with a set while the latter eliminates the data but keeps the settings for it so that if new data is read into the set, it will have the same properties like colouring and line width, etc. Kill set 0 for now.

2.2 Set appearance

We would now like style the sets. Practically all aspects of the curves are configurable including colour, line thickness, symbols, drop lines, fills, etc. These operations are available under the "Set appearance" widget which is invoked by selecting Main:Plot/Set appearance... or by double clicking near the target set within the graph frame.

When the widget comes up, there will be a list of the sets with their number (eg. G0.S1 refers to set 1 in graph 0). Later operations will require you to know the number. Like the data sets pop up, clicking on mouse button 3 in the set list will bring up the menu of set operations.

Colouring all sets differently

The simplest way to colour all sets differently is from Set_Appearance:Data/All colors. First select the sets which you wish to recolour and then select Set_Appearance:Data/All colors. Do this now to your graph.

Customizing each set

When a set in the list is highlighted, the widgets change to reflect the settings. Practically all aspects are configurable. Experiment by changing the line colours and widths, placing a symbol at each data point, not connecting data points and fill the space between the x-axis and the curve. Don't forget to try out what is available under the other tabs besides Main. To see the effect of a change, you have to hit the "Apply" button. N.B.: Things are drawn in numerical order so if there is overlap, the highest numbered item will be on top. This applies to graphs and sets within each graph.

2.3 Labelling the axes using the font tool

Aspects of the axes are controlled by the axes popup which is called from Main:Plot/Axis properties or by double clicking the graph frame. All aspects of the axes can be changed like the title, the font, colour, whether or not to draw grid lines, or user defined tick marks and labels. There are many settings and the best thing to do is to experiment to see what each setting does.

For now, let's start by labelling the axes. Suppose these curves represent the number of tasks a processor runs as the function of the number of users. To make it more interesting, assume we are doing this in Quebec. That means we want to plot "Nombre de tāches vs. nombre d'usagers". Note the importance of having the accent over the a in tāches or we would end up plotting the number of stains which is entirely another case. Bring up the Axes pop up, select the Y axis, and click in the space to enter the label string of the axis label. Start typing Nombre de t. At this point we need to enter a accented letter, so we bring up the font tool by pressing Control-E. You will now see what we have typed in the Cstring widget. Move the cursor to where you want to place the accented letter and click on the letter. It should now appear in the string. You can either finish the string here or hit accept and keep editing. Label the x axis as well. This font tool is available wherever text needs to be entered.

All the attributes regarding the axis labels like size, colour, font, position are changeable.

2.4 Graph titles

Our next exercise will be to title the graph so other. Operation pertaining to this are found in the "Graph appearance" widget which we open by selecting Main:Plot/Graph appearance or by double clicking just above the graph frame.

We can now fill in the title of the graph and by clicking on the "Titles" tab, the font and size and colour can be chosen. The Viewport box under the "Main" tab defines the 4 corners of the graph frame. You can type them in or use the mouse to move them by first double clicking on them.

Other things which can be controlled in this widget are the frame drawn around the graph, whether or not the graph background is coloured and the legends. Legends will be dealt with a little later.

2.5 Legends

Since we have several lines in our graph, it makes sense that we label them with a legend so that other people can figure out what they mean. The first thing to do is to give each set a label. This is done by entering a legend string for each set in the Set appearance popup. Now, from the Main form in the Graph appearance popup, click on "Display legend" to see the legend box. The location and appearance of the box is controlled by clicking on the "Leg. box" tab. The appearance and spacing of the legend entries is controlled by the "Legends" tab. For simplicity, label the sets alphabetically and then play with the appearance, etc. to get something you like.

Specifying the placement of the graph by entering the coordinates can be painful, especially the fine tuning. To alleviate this problem, a graphical method is also available, although not readily apparent. After a legend appears, it may be dragged to a new location. To do this, press Ctrl-L with your mouse on the main canvas. You should see the arrow cursor turn into a hand. If this doesn't work, double click on the main canvas (to get its attention) and then press Ctrl-L. Click on the legend and drag it. To cancel the legend drag mode (as with all other modes), click on mouse button 3.

2.6 A challenge

I got bored so I took the data files and produced my own, albeit ugly, graph. See if you can copy mygraph.png

3. Block Data

A block of data is a table of number which are interpreted as columns of numbers. How sets are created from the columns depends on the information you want to extract from the file.

We first need to read in a block of data. We do this from Main:Data/Import/ASCII. Select the file "3.dat" and Load as "Block data". If the read was successful, a window should pop up asking you to create a set from the block data. At the top it will list how many columns of data were read.

First we choose the type of set we would like. For now we'll stick with xy.

Next we choose which column of data contains the x-ordinate. If theraphicGraph

The object of this tutorial is to do the most basic function of Grace: read in some data into a graph and then label the graph. Along the way, a few of the basic Grace commands and widgets will be introduced.

2.1 Reading the data from a file

Start by bringing up the set reading widget Main:Data/Import/ASCII. Select the file 2.1.dat (both double clicking and hitting return work). You should see a black curve drawn on a graph.

Now we would like to add some more sets to the graph, but this time the data file will be in a slightly different format. Looking at the file "2.1.dat" (with the program of your choice), you can see that its several columns of numbers. One way to interpret this file is the first column gives the x-values and the rest of the columns are y-values. From Grace, again open the "Read Sets" widget. This time, check the "NXY" button. Now select the file "2.1.dat". At this point you will have several differently coloured curves.

You should now have 2 copies of the first set since you've read the file twice. It would be nice to eliminate one copy. This is most easily accomplished by bringing up a popup which lists all the sets. Selecting Main:Edit/Data_sets...bring up the Data set props popup. It lists all the sets and for the selected set, its type and a few statistics. To eliminate a set, select it and then press the right mouse button. A menu should appear from which you can select kill. You'll note that there is a kill and kill data. The former totally eliminates everything associated with a set while the latter eliminates the data but keeps the settings for it so that if new data is read into the set, it will have the same properties like colouring and line width, etc. Kill set 0 for now.

2.2 Set appearance

We would now like style the sets. Practically all aspects of the curves are configurable including colour, line thickness, symbols, drop lines, fills, etc. These operations are available under the "Set appearance" widget which is invoked by selecting Main:Plot/Set appearance... or by double clicking near the target set within the graph frame.

When the widget comes up, there will be a list of the sets with their number (eg. G0.S1 refers to set 1 in graph 0). Later operations will require you to know the number. Like the data sets pop up, clicking on mouse button 3 in the set list will bring up the menu of set operations.

Colouring all sets differently

The simplest way to colour all sets differently is from Set_Appearance:Data/All colors. First select the sets which you wish to recolour and then select Set_Appearance:Data/All colors. Do this now to your graph.

Customizing each set

When a set in the list is highlighted, the widgets change to reflect the settings. Practically all aspects are configurable. Experiment by changing the line colours and widths, placing a symbol at each data point, not connecting data points and fill the space between the x-axis and the curve. Don't forget to try out what is available under the other tabs besides Main. To see the effect of a change, you have to hit the "Apply" button. N.B.: Things are drawn in numerical order so if there is overlap, the highest numbered item will be on top. This applies to graphs and sets within each graph.

2.3 Labelling the axes using the font tool

Aspects of the axes are controlled by the axes popup which is called from Main:Plot/Axis properties or by double clicking the graph frame. All aspects of the axes can be changed like the title, the font, colour, whether or not to draw grid lines, or user defined tick marks and labels. There are many settings and the best thing to do is to experiment to see what each setting does.

For now, let's start by labelling the axes. Suppose these curves represent the number of tasks a processor runs as the function of the number of users. To make it more interesting, assume we are doing this in Quebec. That means we want to plot "Nombre de tāches vs. nombre d'usagers". Note the importance of having the accent over the a in tāches or we would end up plotting the number of stains which is entirely another case. Bring up the Axes pop up, select the Y axis, and click in the space to enter the label string of the axis label. Start typing Nombre de t. At this point we need to enter a accented letter, so we bring up the font tool by pressing Control-E. You will now see what we have typed in the Cstring widget. Move the cursor to where you want to place the accented letter and click on the letter. It should now appear in the string. You can either finish the string here or hit accept and keep editing. Label the x axis as well. This font tool is available wherever text needs to be entered.

All the attributes regarding the axis labels like size, colour, font, position are changeable.

2.4 Graph titles

Our next exercise will be to title the graph so other. Operation pertaining to this are found in the "Graph appearance" widget which we open by selecting Main:Plot/Graph appearance or by double clicking just above the graph frame.

We can now fill in the title of the graph and by clicking on the "Titles" tab, the font and size and colour can be chosen. The Viewport box under the "Main" tab defines the 4 corners of the graph frame. You can type them in or use the mouse to move them by first double clicking on them.

Other things which can be controlled in this widget are the frame drawn around the graph, whether or not the graph background is coloured and the legends. Legends will be dealt with a little later.

2.5 Legends

Since we have several lines in our graph, it makes sense that we label them with a legend so that other people can figure out what they mean. The first thing to do is to give each set a label. This is done by entering a legend string for each set in the Set appearance popup. Now, from the Main form in the Graph appearance popup, click on "Display legend" to see the legend box. The location and appearance of the box is controlled by clicking on the "Leg. box" tab. The appearance and spacing of the legend entries is controlled by the "Legends" tab. For simplicity, label the sets alphabetically and then play with the appearance, etc. to get something you like.

Specifying the placement of the graph by entering the coordinates can be painful, especially the fine tuning. To alleviate this problem, a graphical method is also available, although not readily apparent. After a legend appears, it may be dragged to a new location. To do this, press Ctrl-L with your mouse on the main canvas. You should see the arrow cursor turn into a hand. If this doesn't work, double click on the main canvas (to get its attention) and then press Ctrl-L. Click on the legend and drag it. To cancel the legend drag mode (as with all other modes), click on mouse button 3.

2.6 A challenge

I got bored so I took the data files and produced my own, albeit ugly, graph. See if you can copy mygraph.png

3. Block Data

A block of data is a table of number which are interpreted as columns of numbers. How sets are created from the columns depends on the information you want to extract from the file.

We first need to read in a block of data. We do this from Main:Data/Import/ASCII. Select the file "3.dat" and Load as "Block data". If the read was successful, a window should pop up asking you to create a set from the block data. At the top it will list how many columns of data were read.

First we choose the type of set we would like. For now we'll stick with xy.

Next we choose which column of data contains the x-ordinate. If theraphicGraph

The object of this tutorial is to do the most basic function of Grace: read in some data into a graph and then label the graph. Along the way, a few of the basic Grace commands and widgets will be introduced.

2.1 Reading the data from a file

Start by bringing up the set reading widget Main:Data/Import/ASCII. Select the file 2.1.dat (both double clicking and hitting return work). You should see a black curve drawn on a graph.

Now we would like to add some more sets to the graph, but this time the data file will be in a slightly different format. Looking at the file "2.1.dat" (with the program of your choice), you can see that its several columns of numbers. One way to interpret this file is the first column gives the x-values and the rest of the columns are y-values. From Grace, again open the "Read Sets" widget. This time, check the "NXY" button. Now select the file "2.1.dat". At this point you will have several differently coloured curves.

You should now have 2 copies of the first set since you've read the file twice. It would be nice to eliminate one copy. This is most easily accomplished by bringing up a popup which lists all the sets. Selecting Main:Edit/Data_sets...bring up the Data set props popup. It lists all the sets and for the selected set, its type and a few statistics. To eliminate a set, select it and then press the right mouse button. A menu should appear from which you can select kill. You'll note that there is a kill and kill data. The former totally eliminates everything associated with a set while the latter eliminates the data but keeps the settings for it so that if new data is read into the set, it will have the same properties like colouring and line width, etc. Kill set 0 for now.

2.2 Set appearance

We would now like style the sets. Practically all aspects of the curves are configurable including colour, line thickness, symbols, drop lines, fills, etc. These operations are available under the "Set appearance" widget which is invoked by selecting Main:Plot/Set appearance... or by double clicking near the target set within the graph frame.

When the widget comes up, there will be a list of the sets with their number (eg. G0.S1 refers to set 1 in graph 0). Later operations will require you to know the number. Like the data sets pop up, clicking on mouse button 3 in the set list will bring up the menu of set operations.

Colouring all sets differently

The simplest way to colour all sets differently is from Set_Appearance:Data/All colors. First select the sets which you wish to recolour and then select Set_Appearance:Data/All colors. Do this now to your graph.

Customizing each set

When a set in the list is highlighted, the widgets change to reflect the settings. Practically all aspects are configurable. Experiment by changing the line colours and widths, placing a symbol at each data point, not connecting data points and fill the space between the x-axis and the curve. Don't forget to try out what is available under the other tabs besides Main. To see the effect of a change, you have to hit the "Apply" button. N.B.: Things are drawn in numerical order so if there is overlap, the highest numbered item will be on top. This applies to graphs and sets within each graph.

2.3 Labelling the axes using the font tool

Aspects of the axes are controlled by the axes popup which is called from Main:Plot/Axis properties or by double clicking the graph frame. All aspects of the axes can be changed like the title, the font, colour, whether or not to draw grid lines, or user defined tick marks and labels. There are many settings and the best thing to do is to experiment to see what each setting does.

For now, let's start by labelling the axes. Suppose these curves represent the number of tasks a processor runs as the function of the number of users. To make it more interesting, assume we are doing this in Quebec. That means we want to plot "Nombre de tāches vs. nombre d'usagers". Note the importance of having the accent over the a in tāches or we would end up plotting the number of stains which is entirely another case. Bring up the Axes pop up, select the Y axis, and click in the space to enter the label string of the axis label. Start typing Nombre de t. At this point we need to enter a accented letter, so we bring up the font tool by pressing Control-E. You will now see what we have typed in the Cstring widget. Move the cursor to where you want to place the accented letter and click on the letter. It should now appear in the string. You can either finish the string here or hit accept and keep editing. Label the x axis as well. This font tool is available wherever text needs to be entered.

All the attributes regarding the axis labels like size, colour, font, position are changeable.

2.4 Graph titles

Our next exercise will be to title the graph so other. Operation pertaining to this are found in the "Graph appearance" widget which we open by selecting Main:Plot/Graph appearance or by double clicking just above the graph frame.

We can now fill in the title of the graph and by clicking on the "Titles" tab, the font and size and colour can be chosen. The Viewport box under the "Main" tab defines the 4 corners of the graph frame. You can type them in or use the mouse to move them by first double clicking on them.

Other things which can be controlled in this widget are the frame drawn around the graph, whether or not the graph background is coloured and the legends. Legends will be dealt with a little later.

2.5 Legends

Since we have several lines in our graph, it makes sense that we label them with a legend so that other people can figure out what they mean. The first thing to do is to give each set a label. This is done by entering a legend string for each set in the Set appearance popup. Now, from the Main form in the Graph appearance popup, click on "Display legend" to see the legend box. The location and appearance of the box is controlled by clicking on the "Leg. box" tab. The appearance and spacing of the legend entries is controlled by the "Legends" tab. For simplicity, label the sets alphabetically and then play with the appearance, etc. to get somethi