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