
        function [pos] = trupos (xrange,yrange) ;
%
%--------------------------------------------------------------------------
%
%	Calculate the true position of the axis box within the figure
%	window when 'axis image' is on.
%
%--------------------------------------------------------------------------
%
%   Usage :
%           [pos] = trupos (xrange,yrange) ;
%
%   Input :
%	    xrange  = range of x in data units.
%	    yrange  = range of y in data units.
%
%   Output :
%		pos = [x0 y0 width height] in normalised units of
%		       the axis box.
%
%	See also : mapinit
%
%--------------------------------------------------------------------------
%

	posf = get(gcf,'Position') ; % Units pixels
	posa = get(gca,'Position') ; % Units normalised
%
	r1 = xrange/yrange ;
	r2 = posf(3)/posf(4) ;
%
	if (r1 >= r2),
	    pos(4) = r2*posa(3)/r1 ;
	    pos(2) = posa(2) + 0.5*(posa(4)-pos(4)) ;
	    pos(1) = posa(1) ;
	    pos(3) = posa(3) ;
	else 
	    pos(3) = r1*posa(4)/r2 ;  
	    pos(1) = posa(1) + 0.5*(posa(3)-pos(3)) ;
	    pos(2) = posa(2) ;
	    pos(4) = posa(4) ;
	end

