function plotFTresult(u,x);
%
% A utility for plotting front tracking solutions, the components of u are
% put in separate axes in the same figure. If there is only one component,
% there will only be one axes.
%
[nc n]=size(u);
figure(1); clf;
dp=0.8/nc;dpp=0.05;
for j=1:nc
	yhigh=max(u(j,:)); ylow=min(u(j,:));
	if ylow==yhigh,
		ylow=yhigh-0.5;
		yhigh=ylow+1;
	end;
	dy=0.05*(yhigh-ylow);
	if x(1)==x(n-1),
		xlow=x(1)-0.5;
		xhigh=xlow+1.0;
	else
		xhigh=x(n-1);
		xlow=x(1);
	end;
	dx=0.025*(xhigh-xlow);
	axes('position',[0.1,dpp*(j-1)+0.05+(j-1)*dp,0.8,dp],...
	      'XLim',[xlow-dx,xhigh+dx],'Ylim',[ylow-dy,yhigh+dy],'Box','on');
	x1=xlow-dx;
	for i=1:n-1
		line([x1 x(i)],[u(j,i) u(j,i)]);
		x1=x(i);
		line([x1 x1],[u(j,i) u(j,i+1)]);
	end;
	line([x1 xhigh+dx],[u(j,n),u(j,n)]);
end;
