Browse code

starting som prediction fine-tuned class-performance visualisation

git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@112 83ab2cfd-5345-466c-8aeb-2b2739fb922d

Christoph Budziszewski authored on21/01/2009 16:34:25
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,2085 @@
1
+function r=vis_show_gui_tool(h,action,varargin)
2
+
3
+%VIS_SHOW_GUI_TOOL is a subfunction of SOM_SHOW_GUI.
4
+%
5
+%  r = vis_show_gui_tool(handle, action, varargin)
6
+%
7
+%  Input arguments:
8
+%     handle    (struct) 
9
+%     action    (string)
10
+%     varargin  (varies)
11
+% 
12
+% See also  SOM_SHOW_GUI.
13
+
14
+% Copyright (c) 2000 by Roman Feldman and Juha Vesanto
15
+% Contributed to SOM Toolbox on August 22nd, 2000
16
+% http://www.cis.hut.fi/projects/somtoolbox/
17
+ 
18
+% Version 2.0beta roman 160800 juuso 220800
19
+
20
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21
+
22
+if ishandle(h(1)),
23
+  udata = get(h(1),'UserData');
24
+  if isfield(udata,'plot_array'),
25
+    plot_array = udata.plot_array;
26
+    if isfield(udata,'vis_h')
27
+      % get most recent plotted
28
+      children = get(0,'children');
29
+      %  first refresh plot info
30
+      udata.vis_h = setdiff(udata.vis_h,setdiff(udata.vis_h,children));
31
+      set(h(1),'userdata',udata);
32
+      for i=1:length(children),
33
+        if any(children(i)==udata.vis_h),
34
+          child = children(i);
35
+          [handles,msg,lattice,msize,dim]=vis_som_show_data('all',children(i));
36
+          break;
37
+        elseif i==length(children),
38
+          errordlg({'Plot not found', ...
39
+                    'Try to visualize first'},'Error in SOM_VIS: tools');
40
+          return;
41
+        end
42
+      end
43
+    else
44
+      errordlg({'Plot not found', ...
45
+                'Try to visualize first'},'Error in SOM_VIS: tools');
46
+      return;
47
+    end
48
+  end
49
+end
50
+
51
+%---  color vars  ---
52
+  fig_color = [0.8 0.8 0.8];
53
+  bg_color1 = [0.701960784313725 0.701960784313725 0.701960784313725];
54
+  bg_color2 = [0.9 0.9 0.9];
55
+%---  object position vars (in pixels) ---
56
+  % calculations based on case 'comp'
57
+  %% hint text
58
+  hint_dist1 = 98.17-(61.27+36.9);   % hint text lower edge and next lower frame upper edge
59
+  hint_dist2 = 123-(98.17+18.45);    % figure upper edge and hint text upper edge
60
+  %% general
61
+  dist1 = 67.42-61.27;               % general distance between frame edge and object in frame
62
+  %% frame + ok / cancel
63
+  frames_dist = 61.27-(8.38+36.9);
64
+  frames_dist2 = 8.38;
65
+  f_fr = [7.9 8.38 216.2 36.9];      % final frame
66
+  ok_pb = [17.1 15.76 75.9 22.14];
67
+  cancel_pb = [139 15.76 75.9 22.14];
68
+  %% objects
69
+  hint_txt = [460 18.45];           % hint text width and height
70
+  interp_cb = [98.9 24.6];
71
+  title_txt = [90 hint_txt(2)-3];
72
+  title_edit_h =  23.083;
73
+  var_pop = [interp_cb(1) ok_pb(4)];
74
+  list_lt = [130 130];
75
+  calc_txt = [list_lt(1) hint_txt(2)];
76
+  selvar_pb = [110 ok_pb(4)];
77
+  strd_ed = [var_pop(1) title_edit_h];
78
+  radio_rb = selvar_pb;
79
+  
80
+ %%%%%%%%%%%
81
+% add_label %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82
+ %%%%%%%%%%%
83
+if strcmp(action,'add_label')
84
+  old_fig_n = watchon;
85
+  W = 345.4; H = 222.769;
86
+  o21 = zeros(1,4);
87
+  o21(1) = (W-f_fr(3))/2;
88
+  f_fr = [7.9 8.38 (W-2*7.9) 36.9];      % final frame
89
+  cancel_pb = [(W-(ok_pb(1)+75.9)) 15.76 75.9 22.14];
90
+  hint_txt = [W 18.45];           % hint text width and height
91
+  units = get(h,'units');
92
+  set(h,'units','pixels');
93
+  fp = get(h,'Position');
94
+  fig_pos = [(fp(1)+fp(3)) ...
95
+             (fp(2)+fp(2)+fp(4)/2-H/2) ...
96
+             W ...
97
+             H];
98
+  o1 = sum(f_fr([2 4]))+frames_dist;
99
+  o2 = 4*dist1+2*max([title_edit_h,title_txt(2)]) ...
100
+      +max([title_txt(2),var_pop(2)]);
101
+  o6 = max([title_txt(2),var_pop(2)]);
102
+  o7 = max([title_txt(2),title_edit_h]);
103
+  o8 = max([title_txt(2),title_edit_h,selvar_pb(2)]);
104
+  o3 = o1+0.5*o6+dist1-title_txt(2)/2;
105
+  o4 = o1+0.5*o6+dist1-var_pop(2)/2;  
106
+  o5 = ok_pb(1)+title_txt(1);
107
+  o9 = o1+o6+0.5*o7+2*dist1-title_txt(2)/2;
108
+  o10 = o1+o6+0.5*o7+2*dist1-title_edit_h/2;;
109
+  o11 = o1+o6+o7+0.5*o8+3*dist1-title_txt(2)/2;
110
+  o12 = o1+o6+o7+0.5*o8+3*dist1-title_edit_h/2;
111
+  o13 = o1+o6+o7+0.5*o8+3*dist1-selvar_pb(2)/2;
112
+  o15 = o1+o2+frames_dist2;
113
+  o16 = 2*dist1+o7;
114
+  o17 = o5+strd_ed(1)+2*dist1; % W-ok_pb(1)-selvar_pb(1);
115
+  o18 = o15+0.5*o7+dist1-title_txt(2)/2;
116
+  o19 = o15+0.5*o7+dist1-title_edit_h/2;
117
+  o20 = o15+o16+hint_dist1;
118
+  hint_text_pos = [1 o20 hint_txt];
119
+  frame1_pos = [f_fr(1) o15 f_fr(3) o16];
120
+  subplots_text_pos = [ok_pb(1) o18 title_txt];
121
+  subplots_pos = [o5 o19 strd_ed];
122
+  frame2_pos = [f_fr(1) o1 f_fr(3) o2];
123
+  labels_text_pos = [ok_pb(1) o11 title_txt];
124
+  labels_pos = [o5 o12 strd_ed];
125
+  sel_var_pos = [o17 o13 selvar_pb];
126
+  text_size_text_pos = [ok_pb(1) o9 title_txt];
127
+  text_size_pos = [o5 o10  strd_ed];
128
+  text_color_text_pos = [ok_pb(1) o3 title_txt];
129
+  text_color_pos = [o5 o4 var_pop];
130
+  f_fr = [7.9 8.38 216.2 36.9];      % final frame
131
+  cancel_pb = [139 15.76 75.9 22.14];
132
+  frame3_pos = f_fr+o21;
133
+  ok_pos = ok_pb+o21;
134
+  cancel_pos = cancel_pb+o21;
135
+
136
+  fig_h = figure( ...
137
+    'Units','pixels', ...
138
+    'Position', fig_pos, ...
139
+    'Color',fig_color, ...
140
+    'NumberTitle','off', ...
141
+    'Name','add label', ...
142
+    'MenuBar','none', ...
143
+    'Visible','off');
144
+
145
+    set( ...
146
+    uicontrol( ...                                                            %% hint
147
+      'Units','pixels', ...
148
+      'BackgroundColor',fig_color, ...
149
+      'HorizontalAlignment','center', ...
150
+      'Position',hint_text_pos, ...
151
+      'String','Options for adding labels', ...
152
+      'Style','text'),'units','normalized');
153
+
154
+  set( ...
155
+  uicontrol( ...                                                            %% [frame]
156
+    'Units','pixels', ...
157
+    'Position',frame1_pos, ...
158
+    'Style','frame'),'units','normalized');
159
+
160
+  set( ...
161
+  uicontrol( ...                                                            %% To subplot(s)
162
+    'Units','pixels', ...
163
+    'Position',subplots_text_pos, ...
164
+    'HorizontalAlignment','left', ...
165
+    'String','To subplot(s)', ...
166
+    'Style','text'),'units','normalized');
167
+
168
+  ed1_h = uicontrol( ...                                                    %% [edit]
169
+    'Units','pixels', ...
170
+    'BackgroundColor',bg_color2, ...
171
+    'Position',subplots_pos, ...
172
+    'FontSize',12, ...
173
+    'Style','edit');
174
+  set(ed1_h,'units','normalized');
175
+
176
+  set( ...
177
+  uicontrol( ...                                                            %% [frame]
178
+    'Units','pixels', ...
179
+    'Position',frame2_pos, ...
180
+    'Style','frame'),'units','normalized');
181
+
182
+  set( ...
183
+  uicontrol( ...                                                            %% Labels
184
+    'Units','pixels', ...
185
+    'Position',labels_text_pos, ...
186
+    'HorizontalAlignment','left', ...
187
+    'String','Labels', ...
188
+    'Style','text'),'units','normalized');
189
+
190
+  ed2_h = uicontrol( ...                                                    %% [edit]
191
+    'Units','pixels', ...
192
+    'BackgroundColor',bg_color2, ...
193
+    'Position',labels_pos, ...
194
+    'FontSize',12, ...
195
+    'Style','edit');
196
+  set(ed2_h,'units','normalized');
197
+
198
+  s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ...
199
+       'vis_show_gui_tool(tmp(2),''select'')'];
200
+  set( ...
201
+  uicontrol( ...                                                            %% Select variable
202
+    'Units','pixels', ...
203
+    'Position',sel_var_pos, ...
204
+    'String','Select variable', ...
205
+    'Callback',s),'units','normalized');
206
+
207
+  set( ...
208
+  uicontrol( ...                                                            %% Text size
209
+    'Units','pixels', ...
210
+    'Position',text_size_text_pos, ...
211
+    'HorizontalAlignment','left', ...
212
+    'String','Text size', ...
213
+    'Style','text'),'units','normalized');
214
+
215
+  ed3_h = uicontrol( ...                                                    %% [edit]
216
+    'Units','pixels', ...
217
+    'BackgroundColor',bg_color2, ...
218
+    'Position',text_size_pos, ...
219
+    'String','10', ...
220
+    'FontSize',12, ...
221
+    'Style','edit');
222
+  set(ed3_h,'units','normalized');
223
+
224
+  set( ...
225
+  uicontrol( ...                                                            %% Text color
226
+    'Units','pixels', ...
227
+    'Position',text_color_text_pos, ...
228
+    'HorizontalAlignment','left', ...
229
+    'String','Text color', ...
230
+    'Style','text'),'units','normalized');
231
+
232
+  ud = {'k' 'w' 'y' 'm' 'c' 'r' 'g' 'b' 'xor' 'none'};
233
+  s = {'black' 'white' 'yellow' 'magenta' 'cyan' 'red' 'green' ...
234
+       'blue' 'xor' 'none'};
235
+  p_h = uicontrol( ...                                                      %% [popupmenu]
236
+    'Units','pixels', ...
237
+    'Position',text_color_pos, ...
238
+    'UserData',ud, ...
239
+    'String',s, ...
240
+    'Style','popupmenu');
241
+  set(p_h,'units','normalized');
242
+
243
+  set( ...
244
+  uicontrol( ...                                                            %% [frame]
245
+    'Units','pixels', ...
246
+    'Position',frame3_pos, ...
247
+    'Style','frame'),'units','normalized');
248
+
249
+  s = ['vis_show_gui_tool(' mat2str(h) ',''label'',' mat2str(fig_h) ')'];
250
+  set( ...
251
+  uicontrol( ...                                                            %% OK
252
+    'Units','pixels', ...
253
+    'Position',ok_pos, ...
254
+    'String','OK', ...
255
+    'Callback',s),'units','normalized');
256
+
257
+  set( ...
258
+  uicontrol( ...                                                            %% Cancel
259
+    'Units','pixels', ...
260
+    'Position',cancel_pos, ...
261
+    'String','Cancel', ...
262
+    'Callback',['close(' mat2str(fig_h) ')']),'units','normalized');
263
+
264
+  watchoff(old_fig_n);
265
+  ud = [ed1_h ed2_h ed3_h p_h];
266
+  set(fig_h,'units','normalized', ...
267
+            'Visible','on', ...
268
+            'UserData',ud, ...
269
+            'handlevisibility','off');
270
+
271
+ %%%%%%%%%
272
+% add_hit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
273
+ %%%%%%%%%
274
+elseif strcmp(action,'add_hit')
275
+  old_fig_n = watchon;
276
+  W = 424.3; H = 337.642;
277
+  o37 = zeros(1,4);
278
+  o37(1) = (W-f_fr(3))/2;
279
+  f_fr = [7.9 8.38 (W-2*7.9) 36.9];      % final frame
280
+  cancel_pb = [(W-(ok_pb(1)+75.9)) 15.76 75.9 22.14];
281
+  hint_txt = [W 18.45];           % hint text width and height
282
+  units = get(h,'units');
283
+  set(h,'units','pixels');
284
+  fp = get(h,'Position');
285
+  fig_pos = [(fp(1)+fp(3)) ...
286
+             (fp(2)+fp(2)+fp(4)/2-H/2) ...
287
+             W ...
288
+             H];
289
+  o1 = sum(f_fr([2 4]))+frames_dist;
290
+  o2 = o1+dist1;
291
+  o6 = max([title_txt(2),var_pop(2)]);
292
+  o7 = max([title_txt(2),title_edit_h]);
293
+  o8 = max([title_txt(2),title_edit_h,var_pop(2)]);
294
+  o38 = max([title_txt(2),title_edit_h,selvar_pb(2)]);
295
+  o3 = o8+o6+3*dist1;
296
+  o4 = o1+0.5*o8+dist1-title_txt(2)/2;
297
+  o5 = o1+0.5*o8+dist1-var_pop(2)/2;
298
+  o9 = o1+0.5*o8+dist1-title_edit_h/2;
299
+  o21 = o1+o8+0.5*o6+2*dist1-title_txt(2)/2;
300
+  o22 = o1+o8+0.5*o6+2*dist1-var_pop(2)/2;
301
+  o20 = ok_pb(1)+title_txt(1);
302
+  o10 = o20+var_pop(1)+2*dist1;
303
+  o11 = o10+title_txt(1);
304
+  o12 = o2+o8+dist1+0.5*o6-title_txt(2)/2;
305
+  o13 = o2+o8+dist1+0.5*o6-var_pop(2)/2;
306
+  o14 = o1+o3+frames_dist2;
307
+  o15 = 2*o6+o8+4*dist1;
308
+  o16 = o14+dist1+0.5*o6-title_txt(2)/2;
309
+  o17 = o14+dist1+0.5*o6-var_pop(2)/2;
310
+  o18 = o14+o6+2*dist1+0.5*o8-title_txt(2)/2;
311
+  o19 = o14+o6+2*dist1+0.5*o8-title_edit_h/2;
312
+  o23 = o14+o6+2*dist1+0.5*o8-var_pop(2)/2;
313
+  o24 = o14+o6+3*dist1+o8+0.5*o6-title_txt(2)/2;
314
+  o25 = o14+o6+3*dist1+o8+0.5*o6-var_pop(2)/2;
315
+  o26 = o14+o15+frames_dist2;
316
+  o27 = o8+2*dist1;
317
+  o28 = o26+dist1+0.5*o38-title_txt(2)/2;
318
+  o29 = o26+dist1+0.5*o38-title_edit_h/2;
319
+  o30 = o26+dist1+0.5*o38-selvar_pb(2)/2;
320
+  o31 = o10; %W-(ok_pb(1)+selvar_pb(1));
321
+  o32 = o26+o27+frames_dist2;
322
+  o33 = o7+2*dist1;
323
+  o34 = o32+dist1+0.5*o7-title_txt(2)/2;
324
+  o35 = o32+dist1+0.5*o7-title_edit_h/2;
325
+  o36 = o32+o33+hint_dist1;
326
+  hint_text_pos = [1 o36 hint_txt];
327
+  frame1_pos = [f_fr(1) o32 f_fr(3) o33];
328
+  subplots_text_pos = [ok_pb(1) o34 title_txt];
329
+  subplots_pos = [o20 o35 strd_ed];
330
+  frame2_pos = [f_fr(1) o26 f_fr(3) o27];
331
+  trace_vect_text_pos = [ok_pb(1) o28 title_txt];
332
+  trace_vect_pos = [o20 o29 strd_ed];
333
+  sel_vect_pos = [o31 o30 selvar_pb];
334
+  frame3_pos = [f_fr(1) o14 f_fr(3) o15];
335
+  marker_text_pos = [ok_pb(1) o24 title_txt];
336
+  marker_pos = [o20 o25 var_pop];
337
+  marker_size_text_pos = [ok_pb(1) o18 title_txt];
338
+  marker_size_pos = [o20 o19 strd_ed];
339
+  size_fact_text_pos = [o10 o18 title_txt];
340
+  size_fact_pos = [o11 o23 var_pop];
341
+  marker_color_text_pos = [ok_pb(1) o16 title_txt];
342
+  marker_color_pos = [o20 o17 var_pop];
343
+  edge_color_text_pos = [o10 o16 title_txt];
344
+  edge_color_pos = [o11 o17 var_pop];
345
+  frame4_pos = [f_fr(1) o1 f_fr(3) o3];
346
+  text_text_pos = [ok_pb(1) o21 title_txt];
347
+  text_pos = [o20 o22 var_pop];
348
+  text_color_text_pos = [ok_pb(1) o4 title_txt];
349
+  text_color_pos = [o20 o5 var_pop];
350
+  text_size_text_pos = [o10 o4 title_txt];
351
+  text_size_pos = [o11 o9 strd_ed];
352
+  f_fr = [7.9 8.38 216.2 36.9];      % final frame
353
+  cancel_pb = [139 15.76 75.9 22.14];
354
+  frame5_pos = f_fr+o37;
355
+  ok_pos = ok_pb+o37;
356
+  cancel_pos = cancel_pb+o37;
357
+
358
+  fig_h = figure( ...
359
+    'Units','pixels', ...
360
+    'Position', fig_pos, ...
361
+    'Color',fig_color, ...
362
+    'NumberTitle','off', ...
363
+    'Name','add hit histogram', ...
364
+    'MenuBar','none', ...
365
+    'Visible','off');
366
+
367
+    set( ...
368
+    uicontrol( ...                                                            %% hint
369
+      'Units','pixels', ...
370
+      'BackgroundColor',fig_color, ...
371
+      'HorizontalAlignment','center', ...
372
+      'Position',hint_text_pos, ...
373
+      'String','Options for adding hit histogram', ...
374
+      'Style','text'),'units','normalized');
375
+
376
+  set( ...
377
+  uicontrol( ...                                                            %% [frame]
378
+    'Units','pixels', ...
379
+    'Position',frame1_pos, ...
380
+    'Style','frame'),'units','normalized');
381
+
382
+  set( ...
383
+  uicontrol( ...                                                            %% To subplot(s)
384
+    'Units','pixels', ...
385
+    'Position',subplots_text_pos, ...
386
+    'HorizontalAlignment','left', ...
387
+    'String','To subplot(s)', ...
388
+    'Style','text'),'units','normalized');
389
+
390
+  ed1_h = uicontrol( ...                                                    %% [edit]
391
+    'Units','pixels', ...
392
+    'BackgroundColor',bg_color2, ...
393
+    'Position',subplots_pos, ...
394
+    'FontSize',12, ...
395
+    'Style','edit');
396
+  set(ed1_h,'units','normalized');
397
+
398
+  set( ...
399
+  uicontrol( ...                                                            %% [frame]
400
+    'Units','pixels', ...
401
+    'Position',frame2_pos, ...
402
+    'Style','frame'),'units','normalized');
403
+
404
+  set( ...
405
+  uicontrol( ...                                                            %% Trace vector
406
+    'Units','pixels', ...
407
+    'Position',trace_vect_text_pos, ...
408
+    'HorizontalAlignment','left', ...
409
+    'String','Hit vector', ...
410
+    'Style','text'),'units','normalized');
411
+
412
+  ed2_h = uicontrol( ...                                                    %% [edit]
413
+    'Units','pixels', ...
414
+    'BackgroundColor',bg_color2, ...
415
+    'Position',trace_vect_pos, ...
416
+    'FontSize',12, ...
417
+    'Style','edit');
418
+  set(ed2_h,'units','normalized');
419
+
420
+  s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ...
421
+       'vis_show_gui_tool(tmp(2),''select'')'];
422
+  set( ...
423
+  uicontrol( ...                                                            %% Select variable
424
+    'Units','pixels', ...
425
+    'Position',sel_vect_pos, ...
426
+    'String','Select variable', ...
427
+    'Callback',s),'units','normalized');
428
+
429
+  set( ...
430
+  uicontrol( ...                                                            %% [frame]
431
+    'Units','pixels', ...
432
+    'Position',frame3_pos, ...
433
+    'Style','frame'),'units','normalized');
434
+
435
+  set( ...
436
+  uicontrol( ...                                                            %% Marker
437
+    'Units','pixels', ...
438
+    'Position',marker_text_pos, ...
439
+    'HorizontalAlignment','left', ...
440
+    'String','Marker', ...
441
+    'Style','text'),'units','normalized');
442
+
443
+  s = {'lattice' 'o' '.' 'x' '+' '*' 's' 'd' 'v' '^' ...
444
+       '<' '>' 'p' 'h' 'none' 'cell array'};
445
+  p3_h = uicontrol( ...                                                     %% [popupmenu]
446
+    'Units','pixels', ...
447
+    'Position',marker_pos, ...
448
+    'String',s, ...
449
+    'Style','popupmenu');
450
+  s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ...
451
+       'vis_show_gui_tool([tmp(6),16],''popup_select'')'];
452
+  set(p3_h,'units','normalized','Callback',s);
453
+
454
+  set( ...
455
+  uicontrol( ...                                                            %% Marker size
456
+    'Units','pixels', ...
457
+    'HorizontalAlignment','left', ...
458
+    'Position',marker_size_text_pos, ...
459
+    'String','Marker size', ...
460
+    'Style','text'),'units','normalized');
461
+
462
+  ed4_h = uicontrol( ...                                                    %% [edit]
463
+    'Units','pixels', ...
464
+    'BackgroundColor',bg_color2, ...
465
+    'Position',marker_size_pos, ...
466
+    'String','12', ...
467
+    'FontSize',12, ...
468
+    'Style','edit');
469
+  set(ed4_h,'units','normalized','Callback',s);
470
+
471
+  set( ...
472
+  uicontrol( ...                                                            %% Size factor
473
+    'Units','pixels', ...
474
+    'HorizontalAlignment','left', ...
475
+    'Position',size_fact_text_pos, ...
476
+    'String','Size factor', ...
477
+    'Style','text'),'units','normalized');
478
+
479
+  s = {'common' 'separate'};
480
+  p4_h = uicontrol( ...                                                     %% [popupmenu]
481
+    'Units','pixels', ...
482
+    'Position',size_fact_pos, ...
483
+    'String',s, ...
484
+    'Style','popupmenu');
485
+  set(p4_h,'units','normalized');
486
+
487
+
488
+  set( ...
489
+  uicontrol( ...                                                            %% Marker color
490
+    'Units','pixels', ...
491
+    'HorizontalAlignment','left', ...
492
+    'Position',marker_color_text_pos, ...
493
+    'String','Marker color', ...
494
+    'Style','text'),'units','normalized');
495
+
496
+  ud = {'w' 'k' 'y' 'm' 'c' 'r' 'g' 'b' 'none' ''};
497
+  s = {'white' 'black' 'yellow' 'magenta' 'cyan' ...
498
+       'red' 'green' 'blue' 'none' '-matrix-'};
499
+  p5_h = uicontrol( ...                                                     %% [popupmenu]
500
+    'Units','pixels', ...
501
+    'Position',marker_color_pos, ...
502
+    'UserData',ud, ...
503
+    'String',s, ...
504
+    'Style','popupmenu');
505
+  s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ...
506
+      'vis_show_gui_tool([tmp(9) 10],''popup_select'')'];
507
+  set(p5_h,'units','normalized','Callback',s);
508
+
509
+  set( ...
510
+  uicontrol( ...                                                            %% EdgeColor
511
+    'Units','pixels', ...
512
+    'Position',edge_color_text_pos, ...
513
+    'HorizontalAlignment','left', ...
514
+    'String','Edge color', ...
515
+    'Style','text'),'units','normalized');
516
+
517
+  ud = {'none' 'w' 'k' 'y' 'm' 'c' 'r' 'g' 'b'};
518
+  s = {'none' 'white' 'black' 'yellow' 'magenta' 'cyan' ...
519
+       'red' 'green' 'blue'};
520
+  p6_h = uicontrol( ...                                                     %% [popupmenu]
521
+    'Units','pixels', ...
522
+    'Position',edge_color_pos, ...
523
+    'UserData',ud, ...
524
+    'String',s, ...
525
+    'Style','popupmenu');
526
+  set(p6_h,'units','normalized');
527
+
528
+  set( ...
529
+  uicontrol( ...                                                            %% [frame]
530
+    'Units','pixels', ...
531
+    'Position',frame4_pos, ...
532
+    'Style','frame'),'units','normalized');
533
+
534
+  set( ...
535
+  uicontrol( ...                                                            %% Text
536
+    'Units','pixels', ...
537
+    'Position',text_text_pos, ...
538
+    'HorizontalAlignment','left', ...
539
+    'String','Text', ...
540
+    'Style','text'),'units','normalized');
541
+
542
+  s = {'off' 'on'};
543
+  p2_h = uicontrol( ...                                                     %% [popupmenu]
544
+    'Units','pixels', ...
545
+    'Position',text_pos, ...
546
+    'String',s, ...
547
+    'Style','popupmenu');
548
+  set(p2_h,'units','normalized');
549
+
550
+  set( ...
551
+  uicontrol( ...                                                            %% Text
552
+    'Units','pixels', ...
553
+    'Position',text_text_pos, ...
554
+    'HorizontalAlignment','left', ...
555
+    'String','Text', ...
556
+    'Style','text'),'units','normalized');
557
+
558
+  s = {'off' 'on'};
559
+  p2_h = uicontrol( ...                                                     %% [popupmenu]
560
+    'Units','pixels', ...
561
+    'Position',text_pos, ...
562
+    'String',s, ...
563
+    'Style','popupmenu');
564
+  set(p2_h,'units','normalized');
565
+
566
+  set( ...
567
+  uicontrol( ...                                                            %% Text color
568
+    'Units','pixels', ...
569
+    'Position',text_color_text_pos, ...
570
+    'HorizontalAlignment','left', ...
571
+    'String','Text color', ...
572
+    'Style','text'),'units','normalized');
573
+
574
+  ud = {'k' 'w' 'y' 'm' 'c' 'r' 'g' 'b' 'xor'};
575
+  s = {'black' 'white' 'yellow' 'magenta' 'cyan' ...
576
+       'red' 'green' 'blue' 'xor'};
577
+  p1_h = uicontrol( ...                                                     %% [popupmenu]
578
+    'Units','pixels', ...
579
+    'Position',text_color_pos, ...
580
+    'UserData',ud, ...
581
+    'String',s, ...
582
+    'Style','popupmenu');
583
+  set(p1_h,'units','normalized');
584
+
585
+  set( ...
586
+  uicontrol( ...                                                            %% Text size
587
+    'Units','pixels', ...
588
+    'Position',text_size_text_pos, ...
589
+    'HorizontalAlignment','left', ...
590
+    'String','Text size', ...
591
+    'Style','text'),'units','normalized');
592
+
593
+  ed3_h = uicontrol( ...                                                    %% [edit]
594
+    'Units','pixels', ...
595
+    'BackgroundColor',bg_color2, ...
596
+    'Position',text_size_pos, ...
597
+    'String','3', ...
598
+    'FontSize',12, ...
599
+    'Style','edit');
600
+  set(ed3_h,'units','normalized');
601
+
602
+  set( ...
603
+  uicontrol( ...                                                            %% [frame]
604
+    'Units','pixels', ...
605
+    'Position',frame5_pos, ...
606
+    'Style','frame'),'units','normalized');
607
+
608
+  s = ['vis_show_gui_tool(' mat2str(h) ',''hit'',' mat2str(fig_h) ')'];
609
+  set( ...
610
+  uicontrol( ...                                                            %% OK
611
+    'Units','pixels', ...
612
+    'Position',ok_pos, ...
613
+    'String','OK', ...
614
+    'Callback',s),'units','normalized');
615
+
616
+  set( ...
617
+  uicontrol( ...                                                            %% Cancel
618
+    'Units','pixels', ...
619
+    'Position',cancel_pos, ...
620
+    'String','Cancel', ...
621
+    'Callback',['close(' mat2str(fig_h) ')']),'units','normalized');
622
+
623
+  watchoff(old_fig_n);
624
+  tmp_udata = [ed1_h ed2_h p1_h ed3_h p2_h p3_h ed4_h p4_h p5_h p6_h];
625
+  set(fig_h,'units','normalized', ...
626
+            'Visible','on', ...
627
+            'UserData',tmp_udata, ...
628
+            'handlevisibility','off');
629
+
630
+ %%%%%%%%%%
631
+% add_traj %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
632
+ %%%%%%%%%%
633
+elseif strcmp(action,'add_traj')
634
+  old_fig_n = watchon;
635
+  W = 424.3; H = 337.642;
636
+  o34 = zeros(1,4);
637
+  o34(1) = (W-f_fr(3))/2;
638
+  f_fr = [7.9 8.38 (W-2*7.9) 36.9];      % final frame
639
+  cancel_pb = [(W-(ok_pb(1)+75.9)) 15.76 75.9 22.14];
640
+  hint_txt = [W 18.45];           % hint text width and height
641
+  units = get(h,'units');
642
+  set(h,'units','pixels');
643
+  fp = get(h,'Position');
644
+  fig_pos = [(fp(1)+fp(3)) ...
645
+             (fp(2)+fp(2)+fp(4)/2-H/2) ...
646
+             W ...
647
+             H];
648
+  o1 = sum(f_fr([2 4]))+frames_dist;
649
+  o2 = o1+dist1;
650
+  o6 = max([title_txt(2),var_pop(2)]);
651
+  o7 = max([title_txt(2),title_edit_h]);
652
+  o8 = max([title_txt(2),title_edit_h,var_pop(2)]);
653
+  o38 = max([title_txt(2),title_edit_h,selvar_pb(2)]);
654
+  o20 = ok_pb(1)+title_txt(1);
655
+  o10 = o20+var_pop(1)+2*dist1;
656
+  o11 = o10+title_txt(1);
657
+  o3 = 2*o6+o8+4*dist1;
658
+  o4 = o1+dist1+0.5*o6-title_txt(2)/2;
659
+  o5 = o1+dist1+0.5*o6-var_pop(2)/2;
660
+  o9 = o1+2*dist1+o6+0.5*o8-title_txt(2)/2;
661
+  o12 = o1+2*dist1+o6+0.5*o8-title_edit_h/2;
662
+  o13 = o1+2*dist1+o6+0.5*o8-var_pop(2)/2;
663
+  o14 = o1+3*dist1+o6+o8+0.5*o6-title_edit_h/2;
664
+  o15 = o1+3*dist1+o6+o8+0.5*o6-var_pop(2)/2;
665
+  o16 = o1+o3+frames_dist2;
666
+  o17 = o8+o6+3*dist1;
667
+  o18 = o16+dist1+0.5*o8-title_txt(2)/2;
668
+  o19 = o16+dist1+0.5*o8-title_edit_h/2;
669
+  o21 = o16+dist1+0.5*o8-var_pop(2)/2;
670
+  o22 = o16+2*dist1+o8+0.5*o6-title_txt(2)/2;
671
+  o23 = o16+2*dist1+o8+0.5*o6-var_pop(2)/2;
672
+  o24 = o16+o17+frames_dist2;
673
+  o25 = o38+2*dist1;
674
+  o26 = o24+dist1+0.5*o38-title_txt(2)/2;
675
+  o27 = o24+dist1+0.5*o38-title_edit_h/2;
676
+  o28 = o24+dist1+0.5*o38-selvar_pb(2)/2;
677
+  o29 = o24+o25+frames_dist2;
678
+  o30 = o7+2*dist1;
679
+  o31 = o29+dist1+0.5*o7-title_txt(2)/2;
680
+  o32 = o29+dist1+0.5*o7-title_edit_h/2;
681
+  o33 = o29+o30+hint_dist1;
682
+  hint_text_pos = [1 o33 hint_txt];
683
+  frame1_pos = [f_fr(1) o29 f_fr(3) o30];
684
+  subplots_text_pos = [ok_pb(1) o31 title_txt];
685
+  subplots_pos = [o20 o32 strd_ed];
686
+  frame2_pos = [f_fr(1) o24 f_fr(3) o25];
687
+  trace_vect_text_pos = [ok_pb(1) o26 title_txt];
688
+  trace_vect_pos = [o20 o27 strd_ed];
689
+  sel_vect_pos = [o10 o28 selvar_pb];
690
+  frame3_pos = [f_fr(1) o16 f_fr(3) o17];
691
+  line_color_text_pos = [ok_pb(1) o22 title_txt];
692
+  line_color_pos = [o20 o23 var_pop];
693
+  line_width_text_pos = [ok_pb(1) o18 title_txt];
694
+  line_width_pos = [o20 o19 strd_ed];
695
+  width_factor_text_pos = [o10 o18 title_txt];
696
+  width_factor_pos = [o11 o19 var_pop];
697
+  frame4_pos = [f_fr(1) o1 f_fr(3) o3];
698
+  marker_text_pos = [ok_pb(1) o14 title_txt];
699
+  marker_pos = [o20 o15 var_pop];
700
+  marker_size_text_pos = [ok_pb(1) o9 title_txt];
701
+  marker_size_pos = [o20 o12 strd_ed];
702
+  size_factor_text_pos = [o10 o9 title_txt];
703
+  size_factor_pos = [o11 o13 var_pop];
704
+  marker_color_text_pos = [ok_pb(1) o4 title_txt];
705
+  marker_color_pos = [o20 o5 var_pop];
706
+  edge_color_text_pos = [o10 o4 title_txt];
707
+  edge_color_pos = [o11 o5 var_pop];
708
+  f_fr = [7.9 8.38 216.2 36.9];      % final frame
709
+  cancel_pb = [139 15.76 75.9 22.14];
710
+  frame5_pos = f_fr+o34;
711
+  ok_pos = ok_pb+o34;
712
+  cancel_pos = cancel_pb+o34;
713
+
714
+  fig_h = figure( ...
715
+    'Units','pixels', ...
716
+    'Position', fig_pos, ...
717
+    'Color',fig_color, ...
718
+    'NumberTitle','off', ...
719
+    'Name','add trajectory', ...
720
+    'MenuBar','none', ...
721
+    'Visible','off');
722
+
723
+    set( ...
724
+    uicontrol( ...                                                            %% hint
725
+      'Units','pixels', ...
726
+      'BackgroundColor',fig_color, ...
727
+      'HorizontalAlignment','center', ...
728
+      'Position',hint_text_pos, ...
729
+      'String','Options for adding trajectory', ...
730
+      'Style','text'),'units','normalized');
731
+
732
+  set( ...
733
+  uicontrol( ...                                                            %% [frame]
734
+    'Units','pixels', ...
735
+    'Position',frame1_pos, ...
736
+    'Style','frame'),'units','normalized');
737
+
738
+  set( ...
739
+  uicontrol( ...
740
+    'Units','pixels', ...                                                   %% To subplot(s)
741
+    'Position',subplots_text_pos, ...
742
+    'HorizontalAlignment','left', ...
743
+    'String','To subplot(s)', ...
744
+    'Style','text'),'units','normalized');
745
+
746
+  ed1_h = uicontrol( ...                                                    %% [edit]
747
+    'Units','pixels', ...
748
+    'BackgroundColor',bg_color2, ...
749
+    'Position',subplots_pos, ...
750
+    'FontSize',12, ...
751
+    'Style','edit');
752
+  set(ed1_h,'units','normalized');
753
+
754
+  set( ...
755
+  uicontrol( ...                                                            %% [frame]
756
+    'Units','pixels', ...
757
+    'Position',frame2_pos, ...
758
+    'Style','frame'),'units','normalized');
759
+
760
+  set( ...
761
+  uicontrol( ...                                                            %% Trace vector
762
+    'Units','pixels', ...
763
+    'Position',trace_vect_text_pos, ...
764
+    'HorizontalAlignment','left', ...
765
+    'String','Trajectory', ...
766
+    'Style','text'),'units','normalized');
767
+
768
+  ed2_h = uicontrol( ...                                                    %% [edit]
769
+    'Units','pixels', ...
770
+    'BackgroundColor',bg_color2, ...
771
+    'Position',trace_vect_pos, ...
772
+    'FontSize',12, ...
773
+    'Style','edit');
774
+  set(ed2_h,'units','normalized');
775
+
776
+  s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ...
777
+       'vis_show_gui_tool(tmp(2),''select'')'];
778
+  set( ...
779
+  uicontrol( ...                                                            %% Select variable
780
+    'Units','pixels', ...
781
+    'Position',sel_vect_pos, ...
782
+    'String','Select variable', ...
783
+    'Callback',s),'units','normalized');
784
+
785
+  set( ...
786
+  uicontrol( ...                                                            %% [frame]
787
+    'Units','pixels', ...
788
+    'Position',frame3_pos, ...
789
+    'Style','frame'),'units','normalized');
790
+
791
+  set( ...
792
+  uicontrol( ...                                                            %% Line color
793
+    'Units','pixels', ...
794
+    'Position',line_color_text_pos, ...
795
+    'HorizontalAlignment','left', ...
796
+    'String','Line color', ...
797
+    'Style','text'),'units','normalized');
798
+
799
+  ud = {'w' 'k' 'y' 'm' 'c' 'r' 'g' 'b' 'xor'};
800
+  s = {'white' 'black' 'yellow' 'magenta' 'cyan' ...
801
+       'red' 'green' 'blue' 'xor'};
802
+  p1_h = uicontrol( ...                                                     %% [popupmenu]
803
+    'Units','pixels', ...
804
+    'Position',line_color_pos, ...
805
+    'UserData',ud, ...
806
+    'String',s, ...
807
+    'Style','popupmenu');
808
+  set(p1_h,'units','normalized');
809
+
810
+  set( ...
811
+  uicontrol( ...                                                            %% Line width
812
+    'Units','pixels', ...
813
+    'Position',line_width_text_pos, ...
814
+    'HorizontalAlignment','left', ...
815
+    'String','Line width', ...
816
+    'Style','text'),'units','normalized');
817
+
818
+  ed3_h = uicontrol( ...                                                    %% [edit]
819
+    'Units','pixels', ...
820
+    'BackgroundColor',bg_color2, ...
821
+    'Position',line_width_pos, ...
822
+    'String','3', ...
823
+    'FontSize',12, ...
824
+    'Style','edit');
825
+  set(ed3_h,'units','normalized');
826
+
827
+  set( ...
828
+  uicontrol( ...                                                            %% Factor
829
+    'Units','pixels', ...
830
+    'Position',width_factor_text_pos, ...
831
+    'HorizontalAlignment','left', ...
832
+    'String','Factor', ...
833
+    'Style','text'),'units','normalized');
834
+
835
+  s = {'hit' 'equal'};
836
+  p2_h = uicontrol( ...                                                     %% [popupmenu]
837
+    'Units','pixels', ...
838
+    'Position',width_factor_pos, ...
839
+    'String',s, ...
840
+    'Style','popupmenu');
841
+  set(p2_h,'units','normalized');
842
+
843
+  set( ...
844
+  uicontrol( ...                                                            %% [frame]
845
+    'Units','pixels', ...
846
+    'Position',frame4_pos, ...
847
+    'Style','frame'),'units','normalized');
848
+
849
+  set( ...
850
+  uicontrol( ...                                                            %% Marker
851
+    'Units','pixels', ...
852
+    'Position',marker_text_pos, ...
853
+    'HorizontalAlignment','left', ...
854
+    'String','Marker', ...
855
+    'Style','text'),'units','normalized');
856
+
857
+  s = {'o' '.' 'x' '+' '*' 's' 'd' 'v' '^' ...
858
+       '<' '>' 'p' 'h' 'none'};
859
+  p3_h = uicontrol( ...                                                     %% [popupmenu]
860
+    'Units','pixels', ...
861
+    'Position',marker_pos, ...
862
+    'String',s, ...
863
+    'Style','popupmenu');
864
+  set(p3_h,'units','normalized');
865
+
866
+  set( ...
867
+  uicontrol( ...                                                            %% Marker size
868
+    'Units','pixels', ...
869
+    'HorizontalAlignment','left', ...
870
+    'Position',marker_size_text_pos, ...
871
+    'String','Marker size', ...
872
+    'Style','text'),'units','normalized');
873
+
874
+  ed4_h = uicontrol( ...                                                    %% [edit]
875
+    'Units','pixels', ...
876
+    'BackgroundColor',bg_color2, ...
877
+    'Position',marker_size_pos, ...
878
+    'String','10', ...
879
+    'FontSize',12, ...
880
+    'Style','edit');
881
+  set(ed4_h,'units','normalized');
882
+
883
+  set( ...
884
+  uicontrol( ...                                                            %% Factor
885
+    'Units','pixels', ...
886
+    'HorizontalAlignment','left', ...
887
+    'Position',size_factor_text_pos, ...
888
+    'HorizontalAlignment','left', ...
889
+    'String','Factor', ...
890
+    'Style','text'),'units','normalized');
891
+
892
+  s = {'hit' 'equal'};
893
+  p4_h = uicontrol( ...                                                     %% [popupmenu]
894
+    'Units','pixels', ...
895
+    'Position',size_factor_pos, ...
896
+    'String',s, ...
897
+    'Style','popupmenu');
898
+  set(p4_h,'units','normalized');
899
+
900
+  set( ...
901
+  uicontrol( ...                                                            %% Marker color
902
+    'Units','pixels', ...
903
+    'HorizontalAlignment','left', ...
904
+    'Position',marker_color_text_pos, ...
905
+    'String','Marker color', ...
906
+    'Style','text'),'units','normalized');
907
+
908
+  ud = {'w' 'k' 'y' 'm' 'c' 'r' 'g' 'b' 'none'};
909
+  s = {'white' 'black' 'yellow' 'magenta' 'cyan' ...
910
+       'red' 'green' 'blue' 'none'};
911
+  p5_h = uicontrol( ...                                                     %% [popupmenu]
912
+    'Units','pixels', ...
913
+    'Position',marker_color_pos, ...
914
+    'UserData',ud, ...
915
+    'String',s, ...
916
+    'Style','popupmenu');
917
+  set(p5_h,'units','normalized');
918
+
919
+  set( ...
920
+  uicontrol( ...                                                            %% Edge color
921
+    'Units','pixels', ...
922
+    'Position',edge_color_text_pos, ...
923
+    'HorizontalAlignment','left', ...
924
+    'String','Edge color', ...
925
+    'Style','text'),'units','normalized');
926
+
927
+  ud = {'none' 'w' 'k' 'y' 'm' 'c' 'r' 'g' 'b'};
928
+  s = {'none' 'white' 'black' 'yellow' 'magenta' 'cyan' ...
929
+       'red' 'green' 'blue'};
930
+  p6_h = uicontrol( ...                                                     %% [popupmenu]
931
+    'Units','pixels', ...
932
+    'Position',edge_color_pos, ...
933
+    'UserData',ud, ...
934
+    'String',s, ...
935
+    'Style','popupmenu');
936
+  set(p6_h,'units','normalized');
937
+
938
+  set( ...
939
+  uicontrol( ...                                                            %% [frame]
940
+    'Units','pixels', ...
941
+    'Position',frame5_pos, ...
942
+    'Style','frame'),'units','normalized');
943
+
944
+  s = ['vis_show_gui_tool(' mat2str(h) ',''traj'',' mat2str(fig_h) ')'];
945
+  set( ...
946
+  uicontrol( ...                                                            %% OK
947
+    'Units','pixels', ...
948
+    'Position',ok_pos, ...
949
+    'String','OK', ...
950
+    'Callback',s),'units','normalized');
951
+
952
+  set( ...
953
+  uicontrol( ...                                                            %% Cancel
954
+    'Units','pixels', ...
955
+    'Position',cancel_pos, ...
956
+    'String','Cancel', ...
957
+    'Callback',['close(' mat2str(fig_h) ')']),'units','normalized');
958
+
959
+  watchoff(old_fig_n);
960
+  tmp_udata = [ed1_h ed2_h p1_h ed3_h p2_h p3_h ed4_h p4_h p5_h p6_h];
961
+  set(fig_h,'units','normalized', ...
962
+            'Visible','on', ...
963
+            'UserData',tmp_udata, ...
964
+            'handlevisibility','off');
965
+
966
+ %%%%%%%%%%%
967
+% add_comet %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
968
+ %%%%%%%%%%%
969
+elseif strcmp(action,'add_comet')
970
+  old_fig_n = watchon;
971
+  W = 424.3; H = 265.589;
972
+  o26 = zeros(1,4);
973
+  o26(1) = (W-f_fr(3))/2;
974
+  f_fr = [7.9 8.38 (W-2*7.9) 36.9];      % final frame
975
+  cancel_pb = [(W-(ok_pb(1)+75.9)) 15.76 75.9 22.14];
976
+  hint_txt = [W 18.45];           % hint text width and height
977
+  units = get(h,'units');
978
+  set(h,'units','pixels');
979
+  fp = get(h,'Position');
980
+  fig_pos = [(fp(1)+fp(3)) ...
981
+             (fp(2)+fp(2)+fp(4)/2-H/2) ...
982
+             W ...
983
+             H];
984
+  o1 = sum(f_fr([2 4]))+frames_dist;
985
+  o2 = o1+dist1;
986
+  o6 = max([title_txt(2),var_pop(2)]);
987
+  o7 = max([title_txt(2),title_edit_h]);
988
+  o8 = max([title_txt(2),title_edit_h,var_pop(2)]);
989
+  o38 = max([title_txt(2),title_edit_h,selvar_pb(2)]);
990
+  o20 = ok_pb(1)+title_txt(1);
991
+  o10 = o20+var_pop(1)+2*dist1;
992
+  o11 = o10+title_txt(1);
993
+  o3 = 2*o6+o7+4*dist1;
994
+  o4 = o1+dist1+0.5*o6-title_txt(2)/2;
995
+  o5 = o1+dist1+0.5*o6-var_pop(2)/2;
996
+  o9 = o1+2*dist1+o6+0.5*o7-title_txt(2)/2;
997
+  o12 = o1+2*dist1+o6+0.5*o7-title_edit_h/2;
998
+  o13 = o1+3*dist1+o7+1.5*o6-title_txt(2)/2;
999
+  o14 = o1+3*dist1+o7+1.5*o6-var_pop(2)/2;
1000
+  o15 = o1+o3+frames_dist2;
1001
+  o16 = o38+2*dist1;
1002
+  o17 = o15+dist1+0.5*o38-title_txt(2)/2;
1003
+  o18 = o15+dist1+0.5*o38-title_edit_h/2;
1004
+  o19 = o15+dist1+0.5*o38-selvar_pb(2)/2;
1005
+  o21 = o15+o16+frames_dist2;
1006
+  o22 = o7+2*dist1;
1007
+  o23 = o21+dist1+0.5*o7-title_txt(2)/2;
1008
+  o24 = o21+dist1+0.5*o7-title_edit_h/2;
1009
+  o25 = o21+o22+hint_dist1;
1010
+  hint_text_pos = [1 o25 hint_txt];
1011
+  frame1_pos = [f_fr(1) o21 f_fr(3) o22];
1012
+  subplots_text_pos = [ok_pb(1) o23 title_txt];
1013
+  subplots_pos = [o20 o24 strd_ed];
1014
+  frame2_pos = [f_fr(1) o15 f_fr(3) o16];
1015
+  trace_vect_text_pos = [ok_pb(1) o17 title_txt];
1016
+  trace_vect_pos = [o20 o18 strd_ed];
1017
+  sel_var_pos = [o10 o19 selvar_pb];
1018
+  frame3_pos = [f_fr(1) o1 f_fr(3) o3];
1019
+  marker_text_pos = [ok_pb(1) o13 title_txt];
1020
+  marker_pos = [o20 o14 var_pop];
1021
+  marker_size_text_pos = [ok_pb(1) o9 title_txt];
1022
+  marker_size_pos = [o20 o12 var_pop];
1023
+  marker_color_text_pos = [ok_pb(1) o4 title_txt];
1024
+  marker_color_pos = [o20 o5 var_pop];
1025
+  edge_color_text_pos = [o10 o4 title_txt];
1026
+  edge_color_pos = [o11 o5 var_pop];
1027
+  f_fr = [7.9 8.38 216.2 36.9];      % final frame
1028
+  cancel_pb = [139 15.76 75.9 22.14];
1029
+  frame4_pos = f_fr+o26;
1030
+  ok_pos = ok_pb+o26;
1031
+  cancel_pos = cancel_pb+o26;
1032
+
1033
+  fig_h = figure( ...
1034
+    'Units','pixels', ...
1035
+    'Position', fig_pos, ...
1036
+    'Color',fig_color, ...
1037
+    'NumberTitle','off', ...
1038
+    'Name','add comet', ...
1039
+    'MenuBar','none', ...
1040
+    'Visible','off');
1041
+
1042
+    set( ...
1043
+    uicontrol( ...                                                            %% hint
1044
+      'Units','pixels', ...
1045
+      'BackgroundColor',fig_color, ...
1046
+      'HorizontalAlignment','center', ...
1047
+      'Position',hint_text_pos, ...
1048
+      'String','Options for adding comet', ...
1049
+      'Style','text'),'units','normalized');
1050
+
1051
+  set( ...
1052
+  uicontrol( ...                                                            %% [frame]
1053
+    'Units','pixels', ...
1054
+    'Position',frame1_pos, ...
1055
+    'Style','frame'),'units','normalized');
1056
+
1057
+  set( ...
1058
+  uicontrol( ...                                                            %% To subplot(s)
1059
+    'Units','pixels', ...
1060
+    'Position',subplots_text_pos, ...
1061
+    'HorizontalAlignment','left', ...
1062
+    'String','To subplot(s)', ...
1063
+    'Style','text'),'units','normalized');
1064
+
1065
+  ed1_h = uicontrol( ...                                                    %% [edit]
1066
+    'Units','pixels', ...
1067
+    'BackgroundColor',bg_color2, ...
1068
+    'Position',subplots_pos, ...
1069
+    'FontSize',12, ...
1070
+    'Style','edit');
1071
+  set(ed1_h,'units','normalized');
1072
+
1073
+  set( ...
1074
+  uicontrol( ...                                                            %% [frame]
1075
+    'Units','pixels', ...
1076
+    'Position',frame2_pos, ...
1077
+    'Style','frame'),'units','normalized');
1078
+
1079
+  set( ...
1080
+  uicontrol( ...                                                            %% Trace vector
1081
+    'Units','pixels', ...
1082
+    'Position',trace_vect_text_pos, ...
1083
+    'HorizontalAlignment','left', ...
1084
+    'String','Trace vector', ...
1085
+    'Style','text'),'units','normalized');
1086
+
1087
+  ed2_h = uicontrol( ...                                                    %% [edit]
1088
+    'Units','pixels', ...
1089
+    'BackgroundColor',bg_color2, ...
1090
+    'Position',trace_vect_pos, ...
1091
+    'FontSize',12, ...
1092
+    'Style','edit');
1093
+  set(ed2_h,'units','normalized');
1094
+
1095
+  s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ...
1096
+       'vis_show_gui_tool(tmp(2),''select'')'];
1097
+  set( ...
1098
+  uicontrol( ...                                                            %% Select variable
1099
+    'Units','pixels', ...
1100
+    'Position',sel_var_pos, ...
1101
+    'String','Select variable', ...
1102
+    'Callback',s),'units','normalized');
1103
+
1104
+  set( ...
1105
+  uicontrol( ...                                                            %% [frame]
1106
+    'Units','pixels', ...
1107
+    'Position',frame3_pos, ...
1108
+    'Style','frame'),'units','normalized');
1109
+
1110
+  set( ...
1111
+  uicontrol( ...                                                            %% Marker
1112
+    'Units','pixels', ...
1113
+    'Position',marker_text_pos, ...
1114
+    'HorizontalAlignment','left', ...
1115
+    'String','Marker', ...
1116
+    'Style','text'),'units','normalized');
1117
+
1118
+  s = {'o' '.' 'x' '+' '*' 's' 'd' 'v' '^' ...
1119
+       '<' '>' 'p' 'h' 'lattice' 'none'};
1120
+  p1_h = uicontrol( ...                                                     %% [popupmenu]
1121
+    'Units','pixels', ...
1122
+    'Position',marker_pos, ...
1123
+    'String',s, ...
1124
+    'Style','popupmenu');
1125
+  set(p1_h,'units','normalized');
1126
+
1127
+  set( ...
1128
+  uicontrol( ...                                                            %% Marker size
1129
+    'Units','pixels', ...
1130
+    'HorizontalAlignment','left', ...
1131
+    'Position',marker_size_text_pos, ...
1132
+    'String','Marker size', ...
1133
+    'Style','text'),'units','normalized');
1134
+
1135
+  ed3_h = uicontrol( ...                                                    %% [edit]
1136
+    'Units','pixels', ...
1137
+    'BackgroundColor',bg_color2, ...
1138
+    'Position',marker_size_pos, ...
1139
+    'String','[20 4]', ...
1140
+    'FontSize',12, ...
1141
+    'Style','edit');
1142
+  set(ed3_h,'units','normalized');
1143
+
1144
+  set( ...
1145
+  uicontrol( ...                                                            %% Marker color
1146
+    'Units','pixels', ...
1147
+    'HorizontalAlignment','left', ...
1148
+    'Position',marker_color_text_pos, ...
1149
+    'String','Marker color', ...
1150
+    'Style','text'),'units','normalized');
1151
+
1152
+  ud = {'w' 'k' 'y' 'm' 'c' 'r' 'g' 'b' 'none' ''};
1153
+  s = {'white' 'black' 'yellow' 'magenta' 'cyan' ...
1154
+       'red' 'green' 'blue' 'none' '-matrix-'};
1155
+  p2_h = uicontrol( ...                                                     %% [popupmenu]
1156
+    'Units','pixels', ...
1157
+    'Position',marker_color_pos, ...
1158
+    'UserData',ud, ...
1159
+    'String',s, ...
1160
+    'Style','popupmenu');
1161
+  s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ...
1162
+       'vis_show_gui_tool([tmp(5) 10],''popup_select'')'];
1163
+  set(p2_h,'units','normalized','Callback',s);
1164
+
1165
+  set( ...
1166
+  uicontrol( ...                                                            %% Edge color
1167
+    'Units','pixels', ...
1168
+    'Position',edge_color_text_pos, ...
1169
+    'HorizontalAlignment','left', ...
1170
+    'String','Edge color', ...
1171
+    'Style','text'),'units','normalized');
1172
+
1173
+  ud = {'none' 'w' 'k' 'y' 'm' 'c' 'r' 'g' 'b'};
1174
+  s = {'none' 'white' 'black' 'yellow' 'magenta' 'cyan' ...
1175
+       'red' 'green' 'blue'};
1176
+  p3_h = uicontrol( ...                                                     %% [popupmenu]
1177
+    'Units','pixels', ...
1178
+    'Position',edge_color_pos, ...
1179
+    'UserData',ud, ...
1180
+    'String',s, ...
1181
+    'Style','popupmenu');
1182
+  set(p3_h,'units','normalized');
1183
+
1184
+  set( ...
1185
+  uicontrol( ...                                                            %% [frame]
1186
+    'Units','pixels', ...
1187
+    'Position',frame4_pos, ...
1188
+    'Style','frame'),'units','normalized');
1189
+
1190
+  s = ['vis_show_gui_tool(' mat2str(h) ',''comet'',' mat2str(fig_h) ')'];
1191
+  set( ...
1192
+  uicontrol( ...                                                            %% OK
1193
+    'Units','pixels', ...
1194
+    'Position',ok_pos, ...
1195
+    'String','OK', ...
1196
+    'Callback',s),'units','normalized');
1197
+
1198
+  set( ...
1199
+  uicontrol( ...                                                            %% Cancel
1200
+    'Units','pixels', ...
1201
+    'Position',cancel_pos, ...
1202
+    'String','Cancel', ...
1203
+    'Callback',['close(' mat2str(fig_h) ')']),'units','normalized');
1204
+
1205
+  watchoff(old_fig_n);
1206
+  tmp_udata = [ed1_h ed2_h p1_h ed3_h p2_h p3_h];
1207
+  set(fig_h,'units','normalized', ...
1208
+            'Visible','on', ...
1209
+            'UserData',tmp_udata, ...
1210
+            'handlevisibility','off');
1211
+
1212
+ %%%%%%%%%%%%
1213
+% recolorbar %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1214
+ %%%%%%%%%%%%
1215
+elseif strcmp(action,'recolorbar')
1216
+  old_fig_n = watchon;
1217
+  W = 345.4; H = 237.299;
1218
+  o25 = zeros(1,4);
1219
+  o25(1) = (W-f_fr(3))/2;
1220
+  f_fr = [7.9 8.38 (W-2*7.9) 36.9];      % final frame
1221
+  cancel_pb = [(W-(ok_pb(1)+75.9)) 15.76 75.9 22.14];
1222
+  hint_txt = [W 18.45];           % hint text width and height
1223
+  units = get(h,'units');
1224
+  set(h,'units','pixels');
1225
+  fp = get(h,'Position');
1226
+  fig_pos = [(fp(1)+fp(3)) ...
1227
+             (fp(2)+fp(2)+fp(4)/2-H/2) ...
1228
+             W ...
1229
+             H];
1230
+  o1 = sum(f_fr([2 4]))+frames_dist;
1231
+  o2 = o1+dist1;
1232
+  o6 = max([title_txt(2),var_pop(2)]);
1233
+  o7 = max([title_txt(2),title_edit_h]);
1234
+  o8 = max([title_txt(2),title_edit_h,selvar_pb(2)]);
1235
+  o20 = ok_pb(1)+title_txt(1);
1236
+  o10 = o20+var_pop(1)+2*dist1;
1237
+  o11 = o10+title_txt(1);
1238
+  o3 = o6+2*dist1;
1239
+  o4 = o1+dist1+0.5*o6-title_txt(2)/2;
1240
+  o5 = o1+dist1+0.5*o6-var_pop(2)/2;
1241
+  o9 = o1+o3+frames_dist2;
1242
+  o12 = 2*o8+3*dist1;
1243
+  o13 = o9+dist1+0.5*o8-title_txt(2)/2;
1244
+  o14 = o9+dist1+0.5*o8-title_edit_h/2;
1245
+  o15 = o9+dist1+0.5*o8-var_pop(2)/2;
1246
+  o16 = o9+2*dist1+1.5*o8-title_txt(2)/2;
1247
+  o17 = o9+2*dist1+1.5*o8-title_edit_h/2;
1248
+  o18 = o9+2*dist1+1.5*o8-var_pop(2)/2;
1249
+  o19 = o9+o12+frames_dist2;
1250
+  o21 = o7+2*dist1;
1251
+  o22 = o19+dist1+0.5*o7-title_txt(2)/2;
1252
+  o23 = o19+dist1+0.5*o7-title_edit_h/2;
1253
+  o24 = o19+o21+hint_dist1;
1254
+  hint_text_pos = [1 o24 hint_txt];
1255
+  frame1_pos = [f_fr(1) o19 f_fr(3) o21];
1256
+  subplots_text_pos = [ok_pb(1) o22 title_txt];
1257
+  subplots_pos = [o20 o23 strd_ed];
1258
+  frame2_pos = [f_fr(1) o9 f_fr(3) o12];
1259
+  tics_text_pos = [ok_pb(1) o16 title_txt];
1260
+  tics_pos = [o20 o17 strd_ed];
1261
+  sel_var2_pos = [o10 o18 var_pop];
1262
+  labels_text_pos = [ok_pb(1) o13 title_txt];
1263
+  labels_pos = [o20 o14 strd_ed];
1264
+  sel_var1_pos = [o10 o15 var_pop];
1265
+  frame3_pos = [f_fr(1) o1 f_fr(3) o3];
1266
+  scale_text_pos = [ok_pb(1) o4 title_txt];
1267
+  scale_pos = [o20 o5 1.3*var_pop(1) var_pop(2)];
1268
+  f_fr = [7.9 8.38 216.2 36.9];      % final frame
1269
+  cancel_pb = [139 15.76 75.9 22.14];
1270
+  frame4_pos = f_fr+o25;
1271
+  ok_pos = ok_pb+o25;
1272
+  cancel_pos = cancel_pb+o25;
1273
+
1274
+  fig_h = figure( ...
1275
+    'Units','pixels', ...
1276
+    'Position', fig_pos, ...
1277
+    'Color',fig_color, ...
1278
+    'NumberTitle','off', ...
1279
+    'Name','recolorbar', ...
1280
+    'MenuBar','none', ...
1281
+    'Visible','off');
1282
+
1283
+    set( ...
1284
+    uicontrol( ...                                                            %% hint
1285
+      'Units','pixels', ...
1286
+      'BackgroundColor',fig_color, ...
1287
+      'HorizontalAlignment','center', ...
1288
+      'Position',hint_text_pos, ...
1289
+      'String','Options, recolorbar', ...
1290
+      'Style','text'),'units','normalized');
1291
+
1292
+  set( ...
1293
+  uicontrol( ...                                                            %% [frame]
1294
+    'Units','pixels', ...
1295
+    'Position',frame1_pos, ...
1296
+    'Style','frame'),'units','normalized');
1297
+
1298
+  set( ...
1299
+  uicontrol( ...                                                            %% In subplot(s)
1300
+    'Units','pixels', ...
1301
+    'Position',subplots_text_pos, ...
1302
+    'HorizontalAlignment','left', ...
1303
+    'String','In subplot(s)', ...
1304
+    'Style','text'),'units','normalized');
1305
+
1306
+  ed1_h = uicontrol( ...                                                    %% [edit]
1307
+    'Units','pixels', ...
1308
+    'BackgroundColor',bg_color2, ...
1309
+    'Position',subplots_pos, ...
1310
+    'FontSize',12, ...
1311
+    'Style','edit');
1312
+  set(ed1_h,'units','normalized');
1313
+
1314
+  set( ...
1315
+  uicontrol( ...                                                            %% [frame]
1316
+    'Units','pixels', ...
1317
+    'Position',frame2_pos, ...
1318
+    'Style','frame'),'units','normalized');
1319
+
1320
+  set( ...
1321
+  uicontrol( ...                                                            %% Ticks
1322
+    'Units','pixels', ...
1323
+    'Position',tics_text_pos, ...
1324
+    'HorizontalAlignment','left', ...
1325
+    'String','Ticks', ...
1326
+    'Style','text'),'units','normalized');
1327
+
1328
+  ed3_h = uicontrol( ...                                                    %% [edit]
1329
+    'Units','pixels', ...
1330
+    'BackgroundColor',bg_color2, ...
1331
+    'Position',tics_pos, ...
1332
+    'FontSize',12, ...
1333
+    'Style','edit');
1334
+  set(ed3_h,'units','normalized');
1335
+
1336
+  s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ...
1337
+       'vis_show_gui_tool(tmp(3),''select'')'];
1338
+  set( ...
1339
+  uicontrol( ...                                                            %% Select variable
1340
+    'Units','pixels', ...
1341
+    'Position',sel_var2_pos, ...
1342
+    'String','Select variable', ...
1343
+    'Callback',s),'units','normalized');
1344
+
1345
+  set( ...
1346
+  uicontrol( ...                                                            %% Labels (cell array)
1347
+    'Units','pixels', ...
1348
+    'Position',labels_text_pos, ...
1349
+    'HorizontalAlignment','left', ...
1350
+    'String','Labels', ...
1351
+    'Style','text'),'units','normalized');
1352
+
1353
+  ed2_h = uicontrol( ...                                                    %% [edit]
1354
+    'Units','pixels', ...
1355
+    'BackgroundColor',bg_color2, ...
1356
+    'Position',labels_pos, ...
1357
+    'FontSize',12, ...
1358
+    'Style','edit');
1359
+  set(ed2_h,'units','normalized');
1360
+
1361
+  s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ...
1362
+       'vis_show_gui_tool(tmp(2),''select'')'];
1363
+  set( ...
1364
+  uicontrol( ...                                                            %% Select variable
1365
+    'Units','pixels', ...
1366
+    'Position',sel_var1_pos, ...
1367
+    'String','Select variable', ...
1368
+    'Callback',s),'units','normalized');
1369
+
1370
+  set( ...
1371
+  uicontrol( ...                                                            %% [frame]
1372
+    'Units','pixels', ...
1373
+    'Position',frame3_pos, ...
1374
+    'Style','frame'),'units','normalized');
1375
+
1376
+  set( ...
1377
+  uicontrol( ...                                                            %% Scale
1378
+    'Units','pixels', ...
1379
+    'Position',scale_text_pos, ...
1380
+    'HorizontalAlignment','left', ...
1381
+    'String','Scale', ...
1382
+    'Style','text'),'units','normalized');
1383