This funciton gives a functionality to open a new figure which contains a specified axes when the axes is clicked. This enables you to check the axes in the new figure. The function is convenient when the plotted axes is very small. (e.g. Click one of Thumbnails, then open a new figure to check in detail). [USAGE] vb_axes_add_click_open(h_axes); [IN] h_axes: axes handle. [OUT] none [History] 2013-03-28 rhayashi Initial version Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function vb_axes_add_click_open(h_axes) 0002 % This funciton gives a functionality to open a new figure which contains a 0003 % specified axes when the axes is clicked. This enables you to check 0004 % the axes in the new figure. The function is convenient when the 0005 % plotted axes is very small. 0006 % (e.g. Click one of Thumbnails, then open a new figure to check in detail). 0007 % [USAGE] 0008 % vb_axes_add_click_open(h_axes); 0009 % [IN] 0010 % h_axes: axes handle. 0011 % [OUT] 0012 % none 0013 % [History] 0014 % 2013-03-28 rhayashi Initial version 0015 % Copyright (C) 2011, ATR All Rights Reserved. 0016 % License : New BSD License(see VBMEG_LICENSE.txt) 0017 0018 % 0019 % --- Previous check 0020 % 0021 if ~exist('h_axes', 'var') 0022 error('h_axes is a required parameter.'); 0023 end 0024 if ~isempty(h_axes) && ishandle(h_axes) 0025 if ~strcmp(get(h_axes, 'Type'), 'axes') 0026 error('Specified handle is not axes handle.'); 0027 end 0028 end 0029 0030 % 0031 % --- Main Procedure 0032 % 0033 callback = ['parent = get(gcbo, ''Parent'');', ... 0034 'h_fig = figure;', ... 0035 'new_axes = copyobj(parent, h_fig);', ... 0036 'set(new_axes, ''Position'', [0,0,1,1]);', ... 0037 'set(get(new_axes, ''children''), ''ButtonDownFcn'', '''');', ... 0038 'clear h_fig new_axes h_line parent']; 0039 0040 children = get(h_axes, 'Children'); 0041 set(children, 'ButtonDownFcn', callback);