function previewmap
% PREVIEWMAP view map at printed size
% 
%   PREVIEWMAP changes the size of the current figure to match the printed 
%   output.  This provides an accurate display of the relative placement and 
%   size of objects as they will be printed.  If the resulting figure size 
%   exceeds the screen size, the figure will be enlarged as much as possible.
%   
%   See also PAGEDLG, PAPERSCALE, AXESSCALE

%  Copyright 1996-1998 by Systems Planning and Analysis, Inc. and The MathWorks, Inc.
%  Written by: W. Stumpf
%   $Revision: 1.2 $    $Date: 1998/08/10 17:51:05 $

h = gcf;

figureunits = get(h,'units');
paperunits = get(h,'paperunits');paperpos = get(h,'paperpos');
set(h,'units',paperunits,'pos',paperpos)

pos = get(h,'Position');


if max(abs(pos(3:4) - paperpos(3:4))) > 0.05
	set(h,'units',paperunits,'pos',[0 0 paperpos(3:4)])
	if max(abs(pos(3:4) - paperpos(3:4))) > 0.05
		warning('Figure window larger than screen size. Enlarging as much as possible')
	end
end

set(h,'units',figureunits)

shiftwin(gcf)

figure(gcf)
