IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
view_ratetimesubimages.m
Go to the documentation of this file.
1 %> @ingroup soframework graphicsapi
2 %> @file
3 %> @brief Draw many subplots (subimages) in two rows
4 %>
5 %> First row is rates, second is times3, each column is a different nf
6 %>
7 %> expected dimensions: (subdsperc, number of features, C1 (e.g. C), C2 (e.g. gamma))
8 %>
9 %> This function is not being used a lot; Could be made into a class some time
10 %>
11 %> @sa report_soitem::images_2d
12 %
13 %> @param r sovalues object
14 function view_ratetimesubimages(r) %, saveprefix)
15 
16 
17 oo = sosetup_scene();
18 
19 R = sovalues.getYY(r.values, 'rates');
20 T = sovalues.getYY(r.values, 'times3');
21 [nnf, nc1, nc2, folds] = size(R);
22 
23 % R = reshape(R(end, :, :, :, :), [nnf, nc1, nc2, folds]);
24 % T = reshape(T(end, :, :, :, :), [nnf, nc1, nc2, folds]);
25 
26 meanR = mean(R, 4);
27 meanT = mean(T, 4);
28 maxR = max(meanR(:));
29 minR = min(meanR(:));
30 maxT = max(meanT(:));
31 minT = min(meanT(:));
32 
33 
34 figure;
35 for ww = 1:nnf
36  subplot(2, nnf, ww);
37 
39  o.clim = [minR, maxR];
40  o.dimspec = {[ww 0 0], [1 2]};
41  o.valuesfieldname = 'rates';
42  o.flag_transpose = 1;
43  o.flag_star = 1;
44 % o.chooser = oo.chooser_clarchsel1;
45  o.use(r);
46 
47  replace_title();
48  if ww == 1
49  else
50  xlabel('');
51  ylabel('');
52  end;
53 
54  tickdeal();
55 
56  colorbardeal(ww, nnf, 'rates');
57 
58 
59  %----------------
60 
61 
62  subplot(2, nnf, ww+nnf);
63 
65  o.clim = [minT, maxT];
66  o.dimspec = {[ww 0 0], [1 2]};
67  o.valuesfieldname = 'times3';
68  o.flag_logtake = 1;
69  o.flag_transpose = 1;
70  o.flag_star = 1;
71  o.use(r);
72 
73  title(''); %replace_title();
74 
75  xlabel('');
76  ylabel('');
77 % title('');
78 
79  tickdeal();
80 
81  colorbardeal(ww, nnf, 'times3');
82 % maximize_window();
83 % save_as_png([], [saveprefix, '_times_nf', int2str(ww), '.png']);
84 % close();
85 end;
86 
87 
88 
89 
90 
91 %--------------------------------------------------------------------------
92 function replace_title()
93 
94 st = get(get(gca, 'title'), 'String');
95 semicolonpos = find(st == ';');
96 if ~isempty(semicolonpos)
97  st = st(semicolonpos+2:end);
98  st = strrep(st, 'Number of features: ', 'nf=');
99  title(st);
100  set(get(gca, 'title'), 'FontWeight', 'bold');
101 end;
102 
103 
104 
105 %--------------------------------------------------------------------------
106 function colorbardeal(ww, nnf, s)
107 colorbar('off');
108 p = get(gca, 'Position');
109 if ww == nnf
110  h = colorbar();
111  format_frank(gca, [], h);
112 end;
113 set(gca, 'Position', [p(1:2)-.05, p(3:4)*1.15]);
114 % if ww == nnf
115 % %writes text at right of colorbar
116 % p = get(h, 'Position');
117 %
118 % global FONT FONTSIZE; %#ok<*TLEV>
119 % text('Position', [p(1)+p(3)+0.1, p(2)+p(4)/2, 0], ...
120 % 'Rotation', -90, ...
121 % 'HorizontalAlignment', 'center', ...
122 % 'VerticalAlignment', 'middle', ...
123 % 'FontName', FONT, ...
124 % 'FontSize', scaled(FONTSIZE), ...
125 % 'String', labeldict(s));
126 % end;
127 
128 
129 %--------------------------------------------------------------------------
130 function tickdeal()
131 tl = get(gca, 'XTickLabel');
132 tl = cellfun(@(x) iif(str2num(x) == floor(str2num(x)), x, ''), tl, 'UniformOutput', 0); %#ok<*ST2NM>
133 set(gca, 'XTickLabel', tl);
134 
135 tl = get(gca, 'YTickLabel');
136 tl = cellfun(@(x) iif(str2num(x) == floor(str2num(x)), x, ''), tl, 'UniformOutput', 0); %#ok<*ST2NM>
137 set(gca, 'YTickLabel', tl);
function maximize_window(in h, in aspectratio, in normalizedsize)
Draws image from a sovalues object.
function replace_title()
function save_as_png(in h, in fn, in dpi)
function view_ratetimesubimages(in r)
function scaled(in i)
function iif(in cond, in x1, in x2)
function colorbardeal(in ww, in nnf, in s)
function format_frank(in F, in scale, in handles)
Base for all reports that operate on a soitem object.
Definition: report_soitem.m:2
function tickdeal()