Disabling autoscale in a Xmgrace agr file

I am a heavy user of the Xmgrace plotting program, and I love it. An operation very ofter used is to scale the X and Y axes to our liking, to show different parts of our data in the resulting plot. You can do that from the command line by setting the "world" of the graph, providing four numbers as X,Y boundaries:

% xmgrace -world xmin ymin xmax ymax file.dat

Apart from setting the maximum and minimum values for X and Y, we can make use of the autoscale option to selectively show some ranges. The four options to autoscale are:

  • none - show the X,Y ranges defined by the "world" variable (if not set, the default is "0 0 1 1").
  • xy - forget about "world" data, make plot range in X and Y enough to plot all data in input.
  • x - autoscale X to show all data, but respect Y given by "world". This means that if a point is not shown because it lies outside the Y range, then it doesn't count to force X autoscale. This is a wee bit trickier than it sounds.
  • y - see previous point, with X and Y swapped.

But Xmgrace is not only about command line, or even GUI. You can write a .agr file (for example by saving a plot from the Xmgrace GUI), and manipulate it so that the following command:

% xmgrace file.agr

will bring up a plot with all the data and formatting we have put into the .agr file. It's really handy to save a file as-is.

Now, the syntax for inputting the world in the .agr is well known:

@ world xmin, ymin, xmax, ymax

where xmin etc. are floating point numbers.

The problem is how to hardcode the autoscale feature into the .agr. I had always been forced to do:

% xmgrace -autoscale none file.agr

from the command line, because I couldn't find out how to include it in the .agr. Finally I did find it, and that's the main reason of this post. The syntax is explained in the manual at the Xmrace site, but I found it after googling for agr files containing "autoscale" in them. The line to include seems to be:

@ autoscale onread none

A .agr containing the above line will produce, when called as follows:

% xmgrace file.agr

the same output as a file not containing it, when called as follows:

% xmgrace -autoscale none file.agr

Tags: , , , , , ,

3 thoughts on “Disabling autoscale in a Xmgrace agr file

  1. I use xmgrace to. I have a problem now because i don't now how to convert the agr files in any format that can be seen in windows. I would appreciate any help you can give me.

  2. Adrian, you have a number of options, but they depend on what exactly you want to do. If what you want to do is just see the graph in a Windows machine, you can simply save it as JPG or PNG from within Xmgrace. If you want to be able to manipulate the graph in Windows just as you do in Linux, you need a Windows program that is as good (for you) as Xmgrace (which only runs on Unix-like OSs), and export the data into a format that that program can read. Another option would be to use Xmgrace under Cygwin in Windows.

Leave a Reply

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

Subscribe without commenting