function []=stkxaxis(str, end, del, nchn, nd, label)
%	Plot stackplot x axis.
%
%	function []=stkxaxis(str, end, del, nchn, nd{, label})
%	  str= starting (left) value on the axis {scaler}
%	  end= ending (right) 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}
%	  label= axis label {string} (optional)

%	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;
stkax(:,1)= str*ones(10,1);
stkax(:,2)= end*ones(10,1);
save stkparm.mat stkax stkx0 stky0 stkx1 stky1 stksep ...
                 stkc stkdc stkcht stkcwt stktht stkstht;
%				---------------------------------------
%				Calculate locations of numbers and tics
x= x0;
y= y0;
axl= x1-x0;
itnum= ((end-str)/del)+1;
it= [0:itnum-1]';
sgl= axl/(itnum-1);
ynum= -2.5*cht;
ynum= ynum+y;
ytic= tht+y;
fpn= [str:del:end];
%				---------------------------------------
%				Plot numbers on main axis
fmt= ['%',int2str(nchn),'.',int2str(nd),'f'];
for ig= 1:itnum,
  xnum= x+((ig-1)*sgl)-(nchn*cwt2);
  nstr= sprintf(fmt,fpn(ig));
  text(xnum,ynum,nstr);
end;
%				---------------------------------------
%				Plot main axis line and tics
xt= x + it * sgl;
xt= [xt xt];
yt= [y ytic];
plot([x x+axl], [y y], c, xt, yt, c)
%				---------------------------------------
%				Plot label
if (nargin == 6), 
  label= s_trim(label);
  ln= length(label);
  xl= 0.5 - (ln*cwt);
  yl= -4.0*cht;
  text(xl, yl, label);
end;
%				---------------------------------------
%				Calculate locations of tics on second axis
y= y1;
ytic= -tht+y;
%				---------------------------------------
%				Plot second axis line and tics
yt= [y ytic];
plot([x x+axl], [y y], c, xt, yt, c);
return;
