function []= stkhaxis(str, end, del, mintic)
%	Plot stackplot x axis using hourly increments.
%
%	function []= stkhaxis(str, end, del[, mintic])
%	  str= starting (left) value on the axis in hours{integer scaler}
%	  end= ending (right) value on the axis in hours {integer scaler}
%	  del= delta value on the axis in integer hours {scaler}
%	  mintic= if mintic ~= 0 then tic mark every mintic minutes {scaler} (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;
stht= stkstht;
%				---------------------------------------
%				defaults
if (nargin < 4), mintic = 0; end;
%				---------------------------------------
%				calculate axis boundaries
axl= x1-x0;
%				---------------------------------------
%				Calculate locations of numbers and tics
x= x0;
y= y0;
itnum= ((end-str)/del)+1;
it= [0:itnum-1]';
idtnum= (((end-str)*60)/mintic)+1;
itd= [0:idtnum-1]';
sgl= axl/(itnum-1);
sgld= axl/(idtnum-1);
ynum= -2.0*cht;
ynum= ynum+y;
ymon= -4*cht;
ymon= ymon+y;
ytic= tht+y;
ydtic= (0.75*tht)+y;
fpn= [str:del:end];
%				---------------------------------------
%				Plot numbers on main axis
mon= 0;
for ig= 1:itnum,
  xnum= x+((ig-1)*sgl)-(5*cwt2);
  nstr= sprintf('%2.0f:00',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)
if (mintic ~= 0),
  xtd= x + itd * sgld;
  xtd= [xtd xtd];
  yt= [y ydtic];
  plot(xtd, yt, c)
end;  
%				---------------------------------------
%				Calculate locations of tics on second axis
y= y1;
ytic= -tht+y;
ydtic= -stht+y;
%				---------------------------------------
%				Plot second axis line and tics
yt= [y ytic];
plot([x x+axl], [y y], c, xt, yt, c);
if (mintic ~= 0),
  yt= [y ydtic];
  plot(xtd, yt, c)
end;  
return;
