function modplot(hplotax,freq,fmin,fmax,toplot,nn,mm,nds,name,lnst,lnco,nfunc)
%
%  Name:   modplot
%
%  Usage:  hands=modplot(hplotax,freq,fmin,fmax,toplot,nn,mm,nds,name,nfunc)
%
%  Purpose:  this modifies the type of graph 
%    nn=1  ; one plot
%    nn=2  ; upper plot
%    nn=3  ; lower plot
%    mm=0  ; real axis
%    mm=1  ; semilog axis
%    nds=1 ; primary data set
%    nds=2 ; secondary data set
%

%  Version SWD960822
%
%  Author(s): Phillip Cornwell, cornwell@lanl.gov
%	modified by Scott W. Doebling, doebling@lanl.gov
%
%  Institution: Los Alamos National Laboratory,
%               ESA-EA
%
%  Copyright (c) 1996, The Regents of the University
%       of California. (See top level of code for
%       full copyright statement.)
%

%    Set for overplot by secondary set if appropriate

if nds>1,
   set(hplotax,'NextPlot','add')
end

df = freq(2) - freq(1);

%  Set linestyle

linest = [ lnst(nds,:),lnco(nds)];

%  Plot the data, either log or semilog

axes(hplotax)

plot(freq,toplot,linest)

if mm==1,
	set(hplotax,'yscale','log')
end

%    unset for overplot by secondary set if appropriate

if nds>1,
   set(hplotax,'NextPlot','replace')
end

%     Set the plot title

if nfunc == 1, fname = 'FRF';
elseif nfunc == 2, fname = 'Coherence';
elseif nfunc == 3, fname = 'CPS';
elseif nfunc == 4, fname = 'PSD Resp';
elseif nfunc == 5, fname = 'PSD Ref';
end

hname = text(0,0,[fname,' ',name]);

set(hplotax,'title',hname)

set(hplotax,'xlim',[fmin fmax])

ylim = get(hplotax,'ylim');

i1 = floor(fmin / df) + 1;
i2 = floor(fmax/df) + 1;

set(hplotax,'ylim',[min(ylim(1),min(toplot(i1:i2))) max(ylim(2),max(toplot(i1:i2)))]) 

return

