General Issues

1: Introduction
2: Simple example
3: Fancy example
4: Running Gri
5: Programming Gri
6: General Issues
7: X-Y Plots
8: Contour Plots
9: Image Plots
10: Examples
11: Handling Data
12: Gri Commands
13: Gri Extras
14: Evolution of Gri
15: Installing Gri
16: Gri Bugs
17: System Tools
18: Acknowledgments
19: License
20: Newsgroup

21: Concept Index

6: General Issues

6.1: Missing data

Most Gri commands will ignore data equal to a "missing value." For example, `draw curve' connects only points which are not equal (to within 0.01 percent) of the missing value. The curve has holes at missing data. Initially the missing-value is set to 1.0e22. You may alter this value with `set missing value .value.'. The built-in variable `..missingvalue..' stores the current value of the missing-value.

Additionally, Gri will ignore anything it reads that is equal to the string `NaN' or `Inf'. These are produced by matlab, C, and other programs when dividing by zero, etc.

Gri ignores mathematical operations on data items which are equal to the missing value. Thus, for example, if you missing value is -99 then the command `x += 1' will not change the values equal to -99 to -98, since this would have the side-effect of making the data no longer be considered missing.

6.2: Axes and How to Control Them

6.2.1: Autoscaling of Axes

Gri normally assumes that you are plotting scientific graphs, and therefore whenever it sees a command like `draw curve' or `draw symbol', it draws an appropriate axis first. You can turn this feature off, by using `draw axes none' before the other `draw' command.

Furthermore, Gri picks axis scales by itself, by scanning the (`x', `y') columns. If you don't like the scales Gri picks, you can override them (see Range.).

Gri normally draws axes labelled at left and bottom, and with an axis frame with tics all around. If you don't like this default axis style you can specify other styles. For example, if the commands `draw x axis' and `draw y axis' are placed before the `draw curve' command, Gri will realize you've already specified axes, and just draw them on the left and bottom sides of the box, without completing the axis frame.

For your general use, Gri stores the minimum and maximum x and y values of the axes in the variables `..xleft..', `..xright..', `..ybottom..', and `..ytop..'; for the minimum and maximum values of the data, use the built-in rpnfunctions `min', `max', and `mean'. (see Rpnfunction.). It stores the last (x,y) pair on a curve (whether data or axis) as (`..xlast..',`..ylast..'). Also, Gri stores the axis sizes in `..xsize..' and `..ysize..'. It stores the space to the left of the plot in `..xmargin..' and the space below the plot in `..ymargin..'.

The axis scales are not changed by mathematical operations on the columns, regardless of whether the scales were set manually (by a `set x|y axis' command), or by Gri (during a `read columns' command). In the former case, this is what you probably want, but in the latter case it can lead to graphs with no data, because the scale does not apply to the transformed data. This might be considered a bug; in any case, you can avoid it by transforming the built-in variables `..xleft..' and `..xright..' whenever you transform the x column, and `..ybottom..' and `..ytop..' whenever you transform the y column.

6.2.2: Logarithmic and linear axes

Axes are linear by default; to make logarithmic axes, use commands `set x type log' and `set y type log'.

6.2.3: Length

The axes are normally 10 centimetres long. To set the axis lengths (in centimetres), use commands like `set x size 5' and `set y size 7'. Some people like the ratio of axes to be in the so-called golden ratio `(root(5)-1)/2'; to get that, you could do this:
set x size 15
set y size {rpn ..xsize.. 5 0.5 power 1 - 2 / *}

For maps, you'll want the plot scaled so that shapes retain their aspect ratio. To do this, do `set x size .cm.' and then do `resize y for maps' (or vice versa).

6.2.4: Range

To override axis ranges set by Gri, use `set x axis' and `set y axis'. With these commands, you specify the range of the axes; you may also set the interval for numbered tics, and an interval for unnumbered tics. The unnumbered tics must be at an interval that divides evenly into the numbered tic interval, but the numbered tic interval need not divide into the min/max range. Thus, `set x axis 0 1.1 0.5' will create an axis that will range from 0 to 1.1, with labelled tics at the values 0, 0.5 and 1.

6.2.5: Labels

To set the name of the x axis, use `set x name "string"', and similarly for the y-axis. The default names are `x' and `y'.

6.2.6: Axis location

If you don't like the default position of axes (at left and bottom), you may get Gri to draw axes anywhere you like, using commands like `draw y axis at right' (so the y axis is at the right-hand end of the x range) or `draw x axis at top' (so the x axis is at the top of the plot); you may even specify an exact location, such as `draw x axis at 22.2'.

Normally, the x axis is placed at the bottom end of the y axis, and the y axis is placed at the left end of the x axis. Some people prefer a style in which the axes are positioned a small offset away from these locations. (See example 3, see Fancy Example., for an example.) To get this effect, you may either position the axes yourself, or simply use the `set axes style offset' command (see Set.). If you want this axis style for all their plots, put the line `set axes style offset' in your `~/.emacs' startup file (see Resource File.).