IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
vis_loadings.m
Go to the documentation of this file.
1 %> @brief Visualization - Loadings plots or Peak Location plots for loadings vectors
2 %>
3 %> @sa uip_vis_loadings.m
4 classdef vis_loadings < vis
5  properties
6  %> (optional) Hint dataset. Used to plot a black dashed thin spectrum line on the background
7  data_hint = [];
8  %> =1. (int vector) Index of columns from the Loadings matrix
9  idx_fea = 1;
10  %> =0. Whether to trace a dashed horizontal line to show a minimum altiture threshold from the @c peakdetector
11  %>
12  %> This property is only used if the @pc peakdetector has been specified
13  flag_trace_minalt = 0;
14  %> =0. Whether to take the abs() of the of the loadings
15  flag_abs = 0;
16  %> =[]. Peak detector to mark peaks in the Loadings and Peak Location plots
17  peakdetector = [];
18  %> =0. Loadings Envelope mode. When loadings are very spiky, this can be set to =1 to merge adjacent peaks with a thicker line.
19  %>
20  %> This only takes effect if @c flag_bmtable is 0
21  flag_envelope = 0;
22  %> =0. Activates the "Peak Location Plot" mode
23  flag_bmtable = 0;
24  end;
25 
26  methods
27  function o = vis_loadings()
28  o.classtitle = 'Loadings';
29  o.inputclass = {'fcon_linear', 'block_cascade_base'};
30  end;
31  end;
32 
33  methods(Access=protected)
34  function out = do_use(o, obj)
35  out = [];
36 
37  legends = obj.get_L_fea_names(o.idx_fea);
38 
39  flag_p = ~isempty(o.peakdetector);
40  if ~isempty(o.data_hint)
41  hintx = o.data_hint.fea_x;
42  hinty = mean(o.data_hint.X, 1);
43  else
44  hintx = [];
45  hinty = [];
46  end;
47 
48  if any(o.idx_fea > size(obj.L, 2))
49  irerror(sprintf('There are only %d loadings!', size(obj.L, 2)));
50  end;
51 
52  if ~o.flag_bmtable
53  draw_loadings(obj.L_fea_x, obj.L(:, o.idx_fea), hintx, hinty, legends, o.flag_abs, ...
54  o.peakdetector, o.flag_trace_minalt, flag_p, flag_p, 0, o.flag_envelope);
55  else
56  draw_loadings_pl(obj.L_fea_x, obj.L(:, o.idx_fea), hintx, hinty, legends, o.flag_abs, ...
57  o.peakdetector);
58  end;
59  format_xaxis(obj);
60  set_title(o.classtitle, obj);
61  make_box();
62  end;
63  end;
64 end
function make_box()
function irerror(in s)
Peak Detector.
Definition: peakdetector.m:6
Visualization base class.
Definition: vis.m:4
function draw_loadings(in x, in L, in x_hint, in hint, in legends, in flag_abs, in peakd, in flag_trace_minalt, in flag_draw_peaks, in flag_print_peaks, in flag_histogram, in flag_envelope, in colors)
Visualization - Loadings plots or Peak Location plots for loadings vectors.
Definition: vis_loadings.m:4
function set_title(in s, in obj)
function draw_loadings_pl(in x, in L, in x_hint, in hint, in legends, in flag_abs, in peakd, in colorindexes)
function format_xaxis(in par)