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

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