function []= stkaxis(pltnum, maxnum, str, end, del, nchn, nd)
%	Plot stack axis.
%
%	function []= stkaxis(pltnum, maxnum, str, end, del, nchn, nd)
%	  abs(pltnum)= plot number counting bottom up {scaler}
%	  sign(pltnum)= neg -> plot zero line.
%	  maxnum= total number of plots per page {scaler}
%	  str= starting (lower) value on the axis {scaler}
%	  end= ending (upper) value on the axis {scaler}
%	  del= delta value on the axis {scaler}
%	  nchn= number of characters in the label number {scaler}
%	  nd= number of digits to the right of the decimal place {scaler}

%	Latest revision by P. Dragos 21-May-91.
%
%	P. Dragos, Battelle Ocean Sciences
%	Duxbury, MA 02332
%	(617) 934-0571
%
%	Copyright (c) 1991 by Paul Dragos.
%	This program is copyrighted.  However, you are encouraged to
%	copy and share it, so long as no charge is imposed.

%				---------------------------------------
%				defaults from/to stkparm.mat
load stkparm.mat
x0= stkx0; y0= stky0; x1= stkx1; y1= stky1;
sep= stksep; c= stkc; dc= stkdc; cht= stkcht; cwt= stkcwt; tht= stktht;
cht2= cht/2; cwt2= cwt/2;
zyn= sign(pltnum);
pltnum= abs(pltnum);
stkax(pltnum,3)= str;
stkax(pltnum,4)= end;
save stkparm.mat stkax stkx0 stky0 stkx1 stky1 stksep ...
                 stkc stkdc stkcht stkcwt stktht stkstht;
%				---------------------------------------
%				calculate axis boundaries
axl= ((1.0-sep)/maxnum)-sep;
ystr= ((pltnum-1)*(axl+sep))+sep;
yend= pltnum*(axl+sep);
%				---------------------------------------
%				Calculate locations of numbers and tics
x= x0;
y= ystr;
itnum= ((end-str)/del)+1;
it= [0:itnum-1]';
sgl= axl/(itnum-1);
xnum= -cwt-(nchn*cwt);
xnum= xnum+x;
xtic= tht+x;
fpn= [str:del:end];
%				---------------------------------------
%				Plot numbers on main axis
fmt= ['%',int2str(nchn),'.',int2str(nd),'f'];
for ig= 1:itnum,
  ynum= y+((ig-1)*sgl)-cht2;
  nstr= sprintf(fmt,fpn(ig));
  text(xnum,ynum,nstr);
end;
%				---------------------------------------
%				Plot main axis line and tics
yt= y + it * sgl;
yt= [yt yt];
xt= [x xtic];
plot([x x], [y y+axl], c, xt, yt, c);
%				---------------------------------------
%				Calculate locations of tics on second axis
x= x1;;
xtic= -tht+x;
%				---------------------------------------
%				Plot second axis line and tics
xt= [x xtic];
plot([x x], [y y+axl], c, xt, yt, c);
%				---------------------------------------
%				plot the zero line
if (zyn == -1),
  xz= [x0 x1];
  pz=(0-str)/(end-str);
  yz= [ystr+axl*pz ystr+axl*pz];
  plot(xz,yz,c);
end;
return;
