IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
data_draw.m
Go to the documentation of this file.
1 %>@ingroup datasettools
2 %>@file
3 %>@brief Draws "all curves in dataset"
4 %
5 %> @param data Datast
6 %> @param flag_pieces=0 Whether to use plot_curve_pieces
7 %> @param flag_color_per_row=0 If 0, will use one color inside the COLORS global per class.
8 %> If 1, will use one color inside the COLORS global per data row
9 function data = data_draw(data, flag_pieces, flag_color_per_row)
10 if nargin < 2 || isempty(flag_pieces)
11  flag_pieces = 0;
12 end;
13 if nargin < 3 || isempty(flag_color_per_row)
14  flag_color_per_row = 0;
15 end;
16 
17 if flag_pieces
18  f_plot = @plot_curve_pieces;
19 else
20  f_plot = @plot;
21 end;
22 
23 pieces = data_split_classes(data);
24 h = [];
25 llabels = {};
26 for i = 1:length(pieces)
27  if pieces(i).no > 0
28  %eh = zeros(1, size(pieces(i).X, 2));
29 
30  args = {'LineWidth', scaled(1)};
31  if ~flag_color_per_row
32  args = [args, 'Color', find_color(i)];
33  end;
34  h_temp = f_plot(data.fea_x, pieces(i).X', args{:});
35  if iscell(h_temp)
36  h_temp = cell2mat(h_temp); % plot_curve_pieces returns a cell, which it shouldn't. However, it is too late to change this, for compatibility.
37  end;
38  h(end+1) = h_temp(1);
39  llabels{end+1} = data.classlabels{i};
40  hold on;
41  end;
42 end;
43 legend(h, llabels);
44 
45 alpha(0);
46 
47 format_xaxis(data);
48 format_yaxis(data);
49 format_ylim(data);
50 format_frank();
function find_color(in i)
function plot_curve_pieces(in x, in y, in varargin)
function scaled(in i)
function format_ylim(in yy)
function data_split_classes(in data, in hierarchy)
function format_yaxis(in par)
function format_frank(in F, in scale, in handles)
function data_draw(in data, in flag_pieces, in flag_color_per_row)
function format_xaxis(in par)