Home > chronux_1_50 > spikesort > copyaxes.m

copyaxes

PURPOSE ^

COPYAXES Duplicate axes in a new figure.

SYNOPSIS ^

function target = copyaxes(source)

DESCRIPTION ^

COPYAXES          Duplicate axes in a new figure.
   COPYAXES(AX) makes a copy of the axes specified by the handle AX in a
   new figure.  The copied axes are identical to the original except that
   their position is modified to fill the new parent figure.  This can be
   used to enlarge an axes in a figure subplot.

   AX2 = COPYAXES(AX) returns a handle to the copied axes.

   See also COPYOBJ, COPYFIG.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function target = copyaxes(source)
0002 %COPYAXES          Duplicate axes in a new figure.
0003 %   COPYAXES(AX) makes a copy of the axes specified by the handle AX in a
0004 %   new figure.  The copied axes are identical to the original except that
0005 %   their position is modified to fill the new parent figure.  This can be
0006 %   used to enlarge an axes in a figure subplot.
0007 %
0008 %   AX2 = COPYAXES(AX) returns a handle to the copied axes.
0009 %
0010 %   See also COPYOBJ, COPYFIG.
0011 
0012 %%%%%%%%%%%%%%%%%%%%%%%%%%%% Check Input %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0013 if (~ishandle(source) || ~strcmp(get(source,'Type'), 'axes'))
0014     error('Input must be the handle to an existing axes.');
0015 end
0016 
0017 %%%%%%%%%%%%%%%%%%%%%%%%% Create Target Axes %%%%%%%%%%%%%%%%%%%%%%%%%
0018 hfig = figure;
0019 position = get(gca, 'Position');  % default axes position for single subplot
0020 delete(gca);
0021 
0022 %%%%%%%%%%%%%%%%%%%%%%%%%%% Make the Copy %%%%%%%%%%%%%%%%%%%%%%%%%%%%
0023 target = copyobj(source, hfig);
0024 set(target, 'Position', position);
0025 
0026 if (nargout == 0),  clear target;  end;

Generated on Mon 09-Oct-2006 00:54:52 by m2html © 2003