Table of Contents

#include <axis.h> void xaxis(x0, y0, l, tick, nticks, trans, label) void yaxis(x0, y0, l, tick, nticks, trans, label) real x0, y0, l, tick[]; int ntick; axis_proc trans; string label; void axvar(sznum, szlab, scale) real sznum, szlab, scale; void xaxvar(ndig, tikup, tikdn, numdn, labdn) void yaxvar(ndig, tikup, tikdn, numdn, labdn) int ndig; real tikup, tikdn, numdn, labdn; extern real trans(/* real r */);

With the routines *xaxis*
and *yaxis* a X- and Y-axis can be drawn. Axes can have both tickmarks and labels
(in which case tick values are also drawn), though the programmer can select
any of them to be absent. (x0,y0) is the lower/left edge of the x/y-axis,
and *l* it’s length. *nticks* controls the tick marks along the axis. If positive,
it is the length of the array *tick* containing all of the tick values;
if negative, it’s absolute value gives the number of ticks (excluding the
edges, where ticks are never drawn), and *tick[0],tick[1]* give the minimum
and maximum value along the axis. *trans* is a (real-valued) function (of a
single real-valued argument) that converts world coordinates to cm (the
*yapp* units). *label* is a text string, that is used as a centered label along
the axis. It can be the NULL string, in which case no label and no tick
values are plotted.

*axvar* provides global control over both the X and Y-axis.
*sznum* is the size of the tick values (in cm). *szlab* is the size of the text
label (in cm). *scale* rescales all (6)
**real** axis variables by multiplying
it with the old values. Any of these three parameters can be negative,
in which case no action is undertaken. Defaults are described below.

*xaxvar*
and *yaxvar* provide control over the X and Y axis separately. *ndig* controls
the number of significant digits after the decimal point, with which tick
values are printed (though any trailing zeroes are always deleted). *tikup*
and *tikdn* are the values of the length of the tick up and down from the
axis (the ’down’ is usually 0.0, i.e. ticks are normally not drawn outwards
from an axis). *numdn* is the distance from the axis where the tick values
are drawn. *labdn* is the distance from the axis where the label string is
drawn (default: 1.0cm for both X- and Y-axis). Again, any variable can be given
negative, in which case no action is undertaken.

There is no automatic tick value scaling.

real xrange[2] = {-4, 4}; axis_proc xtrans(); .. xaxvar(-1,0.2,-1,-1,-1); /* redefine big ticks */ xaxis(2, 2, 16, xrange, -7, xtrans, "My-X-label"); xaxvar(-1,0.1,-1,-1,-1); /* set small ticks */ xaxis(2, 2, 16, xrange,-31, xtrans, NULL); xaxvar(-1,0.2,-1,-1,-1); /* and reset */ .. real xtrans(real x) { return 2 + 16*(x-xrange[0])/(xrange[1]-xrange[0]); }

VariableXYComments ndig22number of digits after decimal point tikup0.20.2tick-lenght upward from axis tikdn0.00.0tick-lenght downward from axis numdn0.40.3distance from axis where tick values drawn sznum0.320.32size of tick values labdn1.01.0distance from axis where axis label drawn szlab0.320.32size of axis labels

xx-xxx-86Code writtenJEB 25-apr-92Document writtenPJT xx-xxx-xxAdded automatic tick value scaling optionPJT 16-feb-97axis_proc for SINGLEPRECpjt