Home > GLMdenoise > utilities > axissquarify.m

axissquarify

PURPOSE ^

function h = axissquarify(wantunityline,style)

SYNOPSIS ^

function h = axissquarify(wantunityline,style)

DESCRIPTION ^

 function h = axissquarify(wantunityline,style)

 <wantunityline> (optional) is whether to also draw a unity line.
   default: 1.
 <style> (optional) is the line style to use (only matters if <wantunityline>).
   default: 'g-'.

 make the current axis square-shaped, equal aspect ratio, and centered at origin.
 we ensure that the bounds of the new axis enclose the bounds of the current axis.
 if we draw a unity line, return <h> as the handle to this line.
 otherwise, return <h> as [].

 example:
 figure; axissquarify;

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function h = axissquarify(wantunityline,style)
0002 
0003 % function h = axissquarify(wantunityline,style)
0004 %
0005 % <wantunityline> (optional) is whether to also draw a unity line.
0006 %   default: 1.
0007 % <style> (optional) is the line style to use (only matters if <wantunityline>).
0008 %   default: 'g-'.
0009 %
0010 % make the current axis square-shaped, equal aspect ratio, and centered at origin.
0011 % we ensure that the bounds of the new axis enclose the bounds of the current axis.
0012 % if we draw a unity line, return <h> as the handle to this line.
0013 % otherwise, return <h> as [].
0014 %
0015 % example:
0016 % figure; axissquarify;
0017 
0018 % input
0019 if ~exist('wantunityline','var') || isempty(wantunityline)
0020   wantunityline = 1;
0021 end
0022 if ~exist('style','var') || isempty(style)
0023   style = 'g-';
0024 end
0025 
0026 % do it
0027 ax = axis;
0028 mx = max(abs(ax(1:4)));
0029 if wantunityline
0030   hold on; h = plot([-mx mx],[-mx mx],style);
0031 else
0032   h = [];
0033 end
0034 axis square;
0035 axis([-mx mx -mx mx]);

Generated on Fri 01-Aug-2014 12:03:17 by m2html © 2005