annotate toolboxes/MIRtoolbox1.3.2/somtoolbox/som_show_clear.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function som_show_clear(type, p)
wolffd@0 2
wolffd@0 3 %SOM_SHOW_CLEAR Clear hit marks, labels or trajectories from current figure.
wolffd@0 4 %
wolffd@0 5 % som_show_clear([type], [p])
wolffd@0 6 %
wolffd@0 7 % som_show_clear
wolffd@0 8 % som_show_clear('Traj',[1 2])
wolffd@0 9 %
wolffd@0 10 % Input arguments ([]'s are optional):
wolffd@0 11 % [type] (string) which markers to delete (case insensitive)
wolffd@0 12 % 'hit' to remove hit marks
wolffd@0 13 % 'lab' to remove labels
wolffd@0 14 % 'traj' to remove line trajectories
wolffd@0 15 % 'comet' to remove comet trajectories
wolffd@0 16 % 'all' to remove all (the default)
wolffd@0 17 % [p] (vector) subplot number vector
wolffd@0 18 % (string) 'all' for all subplots (the default)
wolffd@0 19 %
wolffd@0 20 % This function removes the objects made by SOM_SHOW_ADD from a
wolffd@0 21 % figure. If no value is given for p, the function operates on every
wolffd@0 22 % axis in the current figure. It simply searches for the objects with
wolffd@0 23 % certain values in the 'Tag' field. It does not matter if the figure
wolffd@0 24 % objects are created by SOM Toolbox -functions or not. However, if
wolffd@0 25 % vector p or string 'all' _is_ given, the figure has to have been
wolffd@0 26 % created by SOM_SHOW.
wolffd@0 27 %
wolffd@0 28 % For more help, try 'type som_show_clear' or check out the helpdesk.
wolffd@0 29 % See also SOM_SHOW_ADD, SOM_SHOW.
wolffd@0 30
wolffd@0 31 %%%%%%%%% DETAILED DESCRIPTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 32 %
wolffd@0 33 % som_show_clear
wolffd@0 34 %
wolffd@0 35 % PURPOSE
wolffd@0 36 %
wolffd@0 37 % Clear hit marks, labels or trajectories created by SOM_SHOW_ADD
wolffd@0 38 % from the current figure.
wolffd@0 39 %
wolffd@0 40 % SYNTAX
wolffd@0 41 %
wolffd@0 42 % som_show_clear
wolffd@0 43 % som_show_clear([type],[p])
wolffd@0 44 %
wolffd@0 45 % DESCRIPTION
wolffd@0 46 %
wolffd@0 47 % The function SOM_SHOW_ADD creates some markers on the top of
wolffd@0 48 % visualizations made by SOM_SHOW. These objects may be removed using
wolffd@0 49 % SOM_SHOW_CLEAR even if the object handles are not known. The function
wolffd@0 50 % removes the objects based on certain tags written to the 'Tag' property
wolffd@0 51 % field of the objects.
wolffd@0 52 %
wolffd@0 53 % If the function if called without input arguments it searches for
wolffd@0 54 % every object in the current figure that have string
wolffd@0 55 % 'Hit','Lab','Traj' or 'Comet' in their Tag property field and
wolffd@0 56 % deletes them.
wolffd@0 57 %
wolffd@0 58 % If input argument p is not specified, the function does not check that the
wolffd@0 59 % figure is created by function SOM_SHOW.
wolffd@0 60 %
wolffd@0 61 % OPTIONAL INPUT ARGUMENTS
wolffd@0 62 %
wolffd@0 63 % type (string) Which type of markers to delete
wolffd@0 64 % 'Hit' for removing hit marks
wolffd@0 65 % 'Lab' labels
wolffd@0 66 % 'Traj' line trajectories
wolffd@0 67 % 'Comet' comet trajectories
wolffd@0 68 % 'All' all (the default)
wolffd@0 69 % Strings are case insensitive.
wolffd@0 70 %
wolffd@0 71 % p (vector) Subplots from which the markers are removed
wolffd@0 72 % Specifies the subplots from which the markers are removed.
wolffd@0 73 % The valid values are 1...N where N is the number of subplots.
wolffd@0 74 % It is required that the figure has been created by
wolffd@0 75 % the SOM_SHOW function.
wolffd@0 76 %
wolffd@0 77 % EXAMPLES
wolffd@0 78 %
wolffd@0 79 % som_show_clear;
wolffd@0 80 % % deletes all labels, hit marks and trajectories in the figure
wolffd@0 81 % som_show_clear('hit');
wolffd@0 82 % % deletes all the hit marks in the current figure
wolffd@0 83 % som_show_clear('lab',[1 2]);
wolffd@0 84 % % deletes labels in SOM_SHOW figure subplots 1 and 2.
wolffd@0 85 %
wolffd@0 86 % SEE ALSO
wolffd@0 87 %
wolffd@0 88 % som_show Basic map visualizations: component planes, u-matrix etc.
wolffd@0 89 % som_show_add Show hits, labels and trajectories on SOM_SHOW visualization.
wolffd@0 90
wolffd@0 91 % Copyright (c) 1997-2000 by the SOM toolbox programming team.
wolffd@0 92 % http://www.cis.hut.fi/projects/somtoolbox/
wolffd@0 93
wolffd@0 94 % Version 1.0beta Johan 061197
wolffd@0 95 % Version 2.0beta Johan 061099 juuso 181199
wolffd@0 96
wolffd@0 97 %%% Check number of arguments
wolffd@0 98
wolffd@0 99 error(nargchk(0,2, nargin)) % check no. of input args is correct
wolffd@0 100
wolffd@0 101 %%% Initialize & check & action %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 102
wolffd@0 103 if nargin == 0 | isempty(type) | strcmp(type,'all') % delete everything
wolffd@0 104 % in the gcf
wolffd@0 105 delete(findobj(gcf,'Tag','Hit'));
wolffd@0 106 delete(findobj(gcf, 'Tag','Lab'));
wolffd@0 107 delete(findobj(gcf, 'Tag','Traj'));
wolffd@0 108 delete(findobj(gcf, 'Tag','Comet'));
wolffd@0 109 return
wolffd@0 110 end
wolffd@0 111
wolffd@0 112 if nargin < 2 | isempty(p) % check handles
wolffd@0 113 handle=gcf;
wolffd@0 114 else % check subplot handles if p is given
wolffd@0 115 [handle,msg]=vis_som_show_data(p,gcf);
wolffd@0 116 if ~isempty(msg)
wolffd@0 117 error('2nd argument invalid or figure not made by SOM_SHOW: try SOM_SHOW_CLEAR without arguments.');
wolffd@0 118 end
wolffd@0 119 end
wolffd@0 120
wolffd@0 121 switch lower(type) % check type & make proper tag names
wolffd@0 122 case 'hit'
wolffd@0 123 tag = 'Hit';
wolffd@0 124 case 'lab'
wolffd@0 125 tag = 'Lab';
wolffd@0 126 case 'traj'
wolffd@0 127 tag = 'Traj';
wolffd@0 128 case 'comet'
wolffd@0 129 tag = 'Comet';
wolffd@0 130 otherwise
wolffd@0 131 error('Invalid object tag. Must be {lab | hit | traj | comet}');
wolffd@0 132 end
wolffd@0 133
wolffd@0 134 %%% Action %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 135
wolffd@0 136 for i=1:length(handle),
wolffd@0 137 h=findobj(handle(i),'Tag',tag); % find object handles
wolffd@0 138 delete(h); % delete objects
wolffd@0 139 end
wolffd@0 140
wolffd@0 141 %%% No output %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 142