wolffd@0: function som_show_clear(type, p) wolffd@0: wolffd@0: %SOM_SHOW_CLEAR Clear hit marks, labels or trajectories from current figure. wolffd@0: % wolffd@0: % som_show_clear([type], [p]) wolffd@0: % wolffd@0: % som_show_clear wolffd@0: % som_show_clear('Traj',[1 2]) wolffd@0: % wolffd@0: % Input arguments ([]'s are optional): wolffd@0: % [type] (string) which markers to delete (case insensitive) wolffd@0: % 'hit' to remove hit marks wolffd@0: % 'lab' to remove labels wolffd@0: % 'traj' to remove line trajectories wolffd@0: % 'comet' to remove comet trajectories wolffd@0: % 'all' to remove all (the default) wolffd@0: % [p] (vector) subplot number vector wolffd@0: % (string) 'all' for all subplots (the default) wolffd@0: % wolffd@0: % This function removes the objects made by SOM_SHOW_ADD from a wolffd@0: % figure. If no value is given for p, the function operates on every wolffd@0: % axis in the current figure. It simply searches for the objects with wolffd@0: % certain values in the 'Tag' field. It does not matter if the figure wolffd@0: % objects are created by SOM Toolbox -functions or not. However, if wolffd@0: % vector p or string 'all' _is_ given, the figure has to have been wolffd@0: % created by SOM_SHOW. wolffd@0: % wolffd@0: % For more help, try 'type som_show_clear' or check out the helpdesk. wolffd@0: % See also SOM_SHOW_ADD, SOM_SHOW. wolffd@0: wolffd@0: %%%%%%%%% DETAILED DESCRIPTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% wolffd@0: % wolffd@0: % som_show_clear wolffd@0: % wolffd@0: % PURPOSE wolffd@0: % wolffd@0: % Clear hit marks, labels or trajectories created by SOM_SHOW_ADD wolffd@0: % from the current figure. wolffd@0: % wolffd@0: % SYNTAX wolffd@0: % wolffd@0: % som_show_clear wolffd@0: % som_show_clear([type],[p]) wolffd@0: % wolffd@0: % DESCRIPTION wolffd@0: % wolffd@0: % The function SOM_SHOW_ADD creates some markers on the top of wolffd@0: % visualizations made by SOM_SHOW. These objects may be removed using wolffd@0: % SOM_SHOW_CLEAR even if the object handles are not known. The function wolffd@0: % removes the objects based on certain tags written to the 'Tag' property wolffd@0: % field of the objects. wolffd@0: % wolffd@0: % If the function if called without input arguments it searches for wolffd@0: % every object in the current figure that have string wolffd@0: % 'Hit','Lab','Traj' or 'Comet' in their Tag property field and wolffd@0: % deletes them. wolffd@0: % wolffd@0: % If input argument p is not specified, the function does not check that the wolffd@0: % figure is created by function SOM_SHOW. wolffd@0: % wolffd@0: % OPTIONAL INPUT ARGUMENTS wolffd@0: % wolffd@0: % type (string) Which type of markers to delete wolffd@0: % 'Hit' for removing hit marks wolffd@0: % 'Lab' labels wolffd@0: % 'Traj' line trajectories wolffd@0: % 'Comet' comet trajectories wolffd@0: % 'All' all (the default) wolffd@0: % Strings are case insensitive. wolffd@0: % wolffd@0: % p (vector) Subplots from which the markers are removed wolffd@0: % Specifies the subplots from which the markers are removed. wolffd@0: % The valid values are 1...N where N is the number of subplots. wolffd@0: % It is required that the figure has been created by wolffd@0: % the SOM_SHOW function. wolffd@0: % wolffd@0: % EXAMPLES wolffd@0: % wolffd@0: % som_show_clear; wolffd@0: % % deletes all labels, hit marks and trajectories in the figure wolffd@0: % som_show_clear('hit'); wolffd@0: % % deletes all the hit marks in the current figure wolffd@0: % som_show_clear('lab',[1 2]); wolffd@0: % % deletes labels in SOM_SHOW figure subplots 1 and 2. wolffd@0: % wolffd@0: % SEE ALSO wolffd@0: % wolffd@0: % som_show Basic map visualizations: component planes, u-matrix etc. wolffd@0: % som_show_add Show hits, labels and trajectories on SOM_SHOW visualization. wolffd@0: wolffd@0: % Copyright (c) 1997-2000 by the SOM toolbox programming team. wolffd@0: % http://www.cis.hut.fi/projects/somtoolbox/ wolffd@0: wolffd@0: % Version 1.0beta Johan 061197 wolffd@0: % Version 2.0beta Johan 061099 juuso 181199 wolffd@0: wolffd@0: %%% Check number of arguments wolffd@0: wolffd@0: error(nargchk(0,2, nargin)) % check no. of input args is correct wolffd@0: wolffd@0: %%% Initialize & check & action %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% wolffd@0: wolffd@0: if nargin == 0 | isempty(type) | strcmp(type,'all') % delete everything wolffd@0: % in the gcf wolffd@0: delete(findobj(gcf,'Tag','Hit')); wolffd@0: delete(findobj(gcf, 'Tag','Lab')); wolffd@0: delete(findobj(gcf, 'Tag','Traj')); wolffd@0: delete(findobj(gcf, 'Tag','Comet')); wolffd@0: return wolffd@0: end wolffd@0: wolffd@0: if nargin < 2 | isempty(p) % check handles wolffd@0: handle=gcf; wolffd@0: else % check subplot handles if p is given wolffd@0: [handle,msg]=vis_som_show_data(p,gcf); wolffd@0: if ~isempty(msg) wolffd@0: error('2nd argument invalid or figure not made by SOM_SHOW: try SOM_SHOW_CLEAR without arguments.'); wolffd@0: end wolffd@0: end wolffd@0: wolffd@0: switch lower(type) % check type & make proper tag names wolffd@0: case 'hit' wolffd@0: tag = 'Hit'; wolffd@0: case 'lab' wolffd@0: tag = 'Lab'; wolffd@0: case 'traj' wolffd@0: tag = 'Traj'; wolffd@0: case 'comet' wolffd@0: tag = 'Comet'; wolffd@0: otherwise wolffd@0: error('Invalid object tag. Must be {lab | hit | traj | comet}'); wolffd@0: end wolffd@0: wolffd@0: %%% Action %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% wolffd@0: wolffd@0: for i=1:length(handle), wolffd@0: h=findobj(handle(i),'Tag',tag); % find object handles wolffd@0: delete(h); % delete objects wolffd@0: end wolffd@0: wolffd@0: %%% No output %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% wolffd@0: