IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
draw_projections.m
Go to the documentation of this file.
1 %>@ingroup graphicsapi maths
2 %>@file
3 %>@brief Draws projections of each row of DATA.X onto the column vector v
4 %>
5 %> Points are colored according to data.classes.
6 %>
7 %> This is 2D drawing. @c data.X must have 2 columns and @c v must have two elements.
8 %
9 %> @param data
10 %> @param v
11 function draw_projections(data, v)
12 X = data.X;
13 P = X*v*v';
14 
15 for i = 1:data.no
16  plot([X(i, 1), P(i, 1)], [X(i, 2), P(i, 2)], 'k--');
17  hold on;
18 end;
19 
20 X = P; % trick to save memory.
21 pieces = data_split_classes(data);
22 
23 for i = 1:length(pieces)
24  scatter(pieces(i).X(:, 1), pieces(i).X(:, 2), 30, find_color(i), 'filled');
25 end;
26 
function find_color(in i)
function draw_projections(in data, in v)
function data_split_classes(in data, in hierarchy)