function [plotStart] = plotSetUp(tUnits,nTunits,dt)
% Usage: [plotStart] = plotSetUp(tUnits,nTunits,dt);
% Initializes data structure plotStart, which contains
%   parameters used to initialize time series plotting
%   window.   All input arguments are optional.
%   Edit the file to change defaults ... or to add new
%   optional inputs
% tUnits gives units for labeling the x-axis on the time
%   series plot.  Options are 'Seconds', 'Minutes', 'Hours', 'Days' 
% nTunits is number of tUnits of data to plot in one window
%   default is 6 'Hours'
% dt is assumed sampling interval for plotted time series
%   default is 1 ... only used (with tUnits, nTunits)
%   to calculate number of points to plot; should recompute
%   this number after reading data file (so that true sampling
%   interval is known) anyway!

if(nargin < 3)
   dt = 1;
end
if(nargin < 2)
    nTunits = 6;
end
if(nargin == 0)
   tUnits = 'Hours';
end

UNITS = {'Seconds','Minutes', 'Hours', 'Days'};
TFACS = [1,60,3600,86400];
for k = 1:length(UNITS)
   if(strcmp(UNITS{k},tUnits))
      break
   end
end
tFac = TFACS(k);
%  nPw is computed here assuming a sampling interval in the input
%    file (before post-reading decimation) of dt = 1 ... this should
%    always be set after reading the data file, and before intializing
%    the plot
nPw = fix(nTunits*tFac/dt);

i0 = 1;
di = 1;
SCALE = 1;
centered = 1;
rangeScale = .5;
page = 1;
t0Eq0 = 1;
yFac = 1;
T12 = [];
rect0 = [5,35,1015,515];
plotStart = struct('i0',i0,'di',di,'nPw',nPw,'centered',centered,...
        'page',page,'t0Eq0',t0Eq0,'tUnits',tUnits,'nTunits',nTunits,...
        'tFac',tFac,'rangeScale',rangeScale,'yFac',yFac,'T12',T12,...
	'rect',rect0);
