An Xmgrace Tutorial
An Xmgrace Tutorial
1. Introduction
The purpose of this tutorial is to enable you to start making good quality scientific plots quickly.
This will not cover everything - just some of the more important features.
When dealing with items in drop-down menus, we will use something of the form 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.
Things that are to be typed in will be presented in a typewriter font, eg, type y = 3*sin(x).
3. Axis Properties
Main:Plot/Axis properties or by double clicking the graph frame
Aspects of the axes are controlled by the axes popup.
To see the effect of a change, you have to hit the "Apply" button.
In the Main menu:
Choose the axis to adjust using the "Edit" drop menu at the top.
Adjust plot limits: "Start" and "Stop" boxes
Change axis scaling: "Scale" drop menu
Change from ascending to descending order: "Invert axis" button
Axis label: "Label string:" box
4. Set appearance
Main:Plot/Set appearance... or double clicking near the target set
within the graph
This allows you to change the way the sets are graphed.
Practically all aspects of the curves are configurable including colour, line thickness, symbols, drop
lines, fills, etc.
When the window pops up, there will be a list of the sets with their number (eg. G0.S1 refers to set 1 in
graph 0).
To see the effect of a change, you have to hit the "Apply" button. In the Main menu:
Select which set to adjust: "Select set menu" at top.
Turn off or change symbol type: "Type" drop menu in "Symbol properties"
Turn off or change line type: "Type" drop menu in "Line properties"
Create a legend for different point or line types: "String" box in "Legend" ("Display Legend"
must be set in Graph appearance popup window)
5. Graph appearance
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.
Print title and subtitle: "Title" and "Subtitle" boxes
Change how much of the graph window the graph takes up: "Xmin", "Xmax", Ymin",
Ymax" in "Viewport", or use the mouse to move them by first double clicking on them.
Display a legend: "Display legend" button in "Display Options"
6. Operating on Data
Sorting data, joining or splitting datasets: Main:Data/Data_set_operations
Sorting can be done in ascending or descending order, and by the x- or y-coordinate. It is also possible
to combine or split datasets.
you will shift all points of your set 4966.5 units to the left.
You can use more than one set in the same formula, like this:
y = y - 0.653 * sin (x deg) + s2.y
which means you use both X and Y from the source set but also the Y coordinate of set 2. Beware that
the loop is a simple loop over the indices, all the sets you use in such an hybrid expression should
therefore have the same number of points and point i of one set should really be related to point i of the
other set. If your sets do not follow these requirements, you should first homogenize them using
interpolation.
Choose file type: "Device" drop menu in "Device setup" - Postscript is best for most
applications.
Print: "Print command" box in "Output" - this is the unix command that will be used to print
(e.g. "lpr -Plaser").
Produce a file: "Print to file" button in "Output" - you will then be asked to name the file.
Change the orientation of the graph on the page: "Orientation" drop menu in "Page" "Landscape" puts the x-axis on the long side of the page, "Portrait" put the x-axis on the short
side
Operator
+
*
/
%
^
Description
addition
substraction
multiplication
division
modulus
raising to power
Arithmetic operators
Operator
AND or &&
OR or ||
NOT or !
Description
logical AND
logical OR
logical NOT
Logical operators
Operator
EQ or ==
NE or !=
LT or <
LE or <=
GT or >
GE or >=
Description
equal
not equal
less than
less than or equal
greater than
greater than or equal
Comparison operators
Another conditional operator is the "?:" (or ternary) operator, which operates as in C and many other
languages.
(expr1) ? (expr2) : (expr3);
This expression evaluates to expr2 if expr1 evaluates to TRUE, and expr3 if expr1 evaluates to FALSE.
Function
abs(x)
acos(x)
acosh(x)
asin(x)
asinh(x)
atan(x)
atan2(y,x)
atanh(x)
ceil(x)
cos(x)
cosh(x)
exp(x)
fac(n)
floor(x)
irand(n)
ln(x)
log10(x)
log2(x)
maxof(x,y)
mesh(n)
mesh(x1, x2, n)
minof(x,y)
mod(x,y)
pi
rand
rand(n)
rint(x)
rsum(x)
sin(x)
Description
absolute value
arccosine
hyperbolic arccosine
arcsine
hyperbolic arcsine
arctangent
arc tangent of two variables
hyperbolic arctangent
greatest integer function
cosine
hyperbolic cosine
e^x
factorial function, n!
least integer function
random integer less than n
natural log
log base 10
base 2 logarithm of x
returns greater of x and y
mesh array (0 ... n - 1)
mesh array of n equally spaced points between x1 and x2 inclusive
returns lesser of x and y
mod function (also x % y)
the PI constant
pseudo random number distributed uniformly on (0.0,1.0)
array of n random numbers
round to closest integer
running sum of x
sine function
sinh(x)
sqr(x)
sqrt(x)
tan(x)
tanh(x)
hyperbolic sine
x^2
x^0.5
tangent function
hyperbolic tangent
Functions
Function
chdtr(df, x)
chdtrc(v, x)
chdtri(df, y)
erf(x)
erfc(x)
fdtr(df1, df2, x)
fdtrc(x)
fdtri(x)
gdtr(a, b, x)
gdtrc(a, b, x)
ndtr(x)
ndtri(x)
norm(x)
pdtr(k, m)
pdtrc(k, m)
pdtri(k, y)
rnorm(xbar,s)
stdtr(k, t)
stdtri(k, p)
Description
chi-square distribution
complemented Chi-square distribution
inverse of complemented Chi-square distribution
error function
complement of error function
F distribution function
complemented F distribution
inverse of complemented F distribution
gamma distribution function
complemented gamma distribution function
Normal distribution function
inverse of Normal distribution function
gaussian density function
Poisson distribution
complemented Poisson distribution
inverse Poisson distribution
pseudo random number distributed N(xbar,s)
Student's t distribution
functional inverse of Student's t distribution
Statistical functions
Function
MIN(x)
MAX(x)
AVG(x)
SD(x)
Description
min value of array x
max value of array x
average of array x
standard deviation of array x
SUM(x)
INT(x,y)
IMIN(x)
IMAX(x)