function y=tcplot(temp,sal,depth,mid,flg);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Function routine to try and get around an
% annoying bug in the batch processing of
% plots from a scripts.  The xaxis keeps
% changing from plot to plot.  Try to 
% isolate things in this file
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Use Mike cooks 3-axis CTD plotter but modified for the 
% T-C chain data.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fpath=['/data/span9/bahr/perlprogs/'];
% step 1) compute density
	
	ll=((flg(:,3)==0)&(flg(:,5)==0));
	dens(ll)=sw_pden(sal(ll),temp(ll),depth(ll),0);
	dens(ll)=dens(ll)-1000;
	dens(~ll)=NaN;
	ll=(flg(:,3)==0);
	temp(~ll)=NaN;
	ll=(flg(:,5)==0);
	sal(~ll)=NaN;
	dtat=[depth(:) temp(:) sal(:) dens(:)];
	figure('Visible','off','Position',[200 200 300 600]);
	set(gcf,'Units','inches');
	set(gcf,'PaperPosition',[1.5 1.5,6.5,9]);
	plotTSRho(dtat);
	grid on
	set(gca,'FontWeight','bold','FontSize',20);
	pltnm=['m',num2str(mid),'_tsrprof.ppm'];
	eval(['print -dppm ',fpath,pltnm,';']);
	close;
	clf;
