function[]=tick_fr(axh,ax,fr,first)
if (nargin==0)
    disp(['---------------------------------------------',
          'written by senya@atmos.umd.edu v0.2 3/13/02  ',
          'USAGE: tick_fr(axh,ax,fr,first)              ',
          'axh - axes handle, <gca> for current ones    ',
          'ax axis name "x"   - horizontal              ',
          '             "y"   - vertical                ',
          'fr frequency of tick labels appearance       ',
          'fr=2 means label each second                 ',
          'first is the number of the first tick labeled',
          '---------------------------------------------'])
    return
end
if (nargin==3)
    first=1;
end

tc=cellstr(feval('get',axh,[ax 'ticklabel']));
tc1=cell(size(tc));
ind=[first:fr:length(tc)];
tc1(ind)=tc(ind);
feval('set',axh,[ax 'ticklabel'],tc1);

% check for axis scaling
tick=feval('get',axh,[ax 'tick']);
ticklabel=feval('get',axh,[ax 'ticklabel']);

if(length(ticklabel)==1)
return
end

for i=1:length(tick)
	if(~isempty(str2num(ticklabel{i})))
		ticklabeln(i)=str2num(ticklabel{i});
	else
		ticklabeln(i)=0;
	end
end

ind=find(ticklabeln~=0);

if (length(ind)>0)
scale=mean(tick(ind)./ticklabeln(ind));
pow=log10(scale);
if (pow~=0)
xlim=get(axh,'xlim');
ylim=get(axh,'ylim');
if(ax=='y')
x=xlim(1);
y=ylim(2);
else
x=xlim(2);
y=ylim(1);
end
at=text(x,y,[' x 10^{' int2str(pow) '}']);
set(at,'fontsize',get(axh,'fontsize'),'verticalalignment','bottom');
end
end
% axis scale
