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