IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
fig_assert.m
Go to the documentation of this file.
1 %>@ingroup graphicsapi globals idata assert
2 %>@file
3 %>@brief Initializes globals COLORS, FONT, MARKERS, etc, if not present.
4 %>
5 %> Please check the source code for reference on variables and default values.
6 function fig_assert()
7 global COLORS MARKERS MARKERSIZES FONT FONTSIZE LINESTYLES SCALE COLORS_STACKEDHIST;
8 
9 if isempty(SCALE)
10  %Multiplier for MARKERSIZES, FONTSIZE, line widths etc
11  SCALE = 1;
12 end;
13 
14 if isempty(COLORS)
15  % Sequence of colors for general purpose
16  a = [...
17  228, 26, 28; ...
18  55, 126, 184; ...
19  77, 175, 74; ...
20  152, 78, 163; ...
21  255, 127, 0; ...
22  255, 255, 51; ...
23  166, 86, 40; ...
24  247, 129, 191; ...
25  153, 153, 153; ...
26  ];
27  a = round(a/255*1000)/1000;
28  COLORS = mat2cell(a, ones(1, size(a, 1)), 3);
29 end;
30 
31 if isempty(LINESTYLES)
32  % Sequence of line styles
33  LINESTYLES = {'-', '--', '-.'};
34 end;
35 if isempty(MARKERS)
36  % Sequence of markers for scatterplots etc.
37  MARKERS = 'so^dvp<h>';
38  % Sequence of marker sizes. Must match @c MARKERS in number of elements.
39  MARKERSIZES = 2*[3 3 3 3 3 3 3 3 3];
40 end;
41 if isempty(FONT)
42  % Font for figure axis labels, legend, title etc.
43  FONT = 'Arial';
44 end;
45 if isempty(FONTSIZE)
46  % Font size for figure axis labels, legend, title etc.
47  %
48  % FONTSIZE = 40; % Becomes aprox. 16.5 when a 300dpi PNG is exported and made 18cm wide in Word.
49  % % PS: I think it goes well on my 1650x... monitor but a different screen size would need another FONTSIZE
50  % % to achieve the same effect (i.e. font size of 16.5 in Word)
51  % % This is good provision for potential reduction when the figure goes to the paper
52  FONTSIZE = 20;
53 end;
54 if isempty(COLORS_STACKEDHIST)
55  % Colors for draw_stacked() (stacked feature histogram)
56  COLORS_STACKEDHIST = make_colors_stackedhist();
57 end;
58 
59 
60 %---------------------------------
61 function c = make_colors_stackedhist()
62 % This is the colormap that was used for the stacked histograms
63 
64 cm = jet(20);
65 cm = cm(19:-2:1, :);
66 f = (cos(linspace(0, 2*pi, 10))*.1+1)';
67 cm = bsxfun(@times, cm, f);
68 cm = cm/max(cm(:));
69 cm = round(cm*1000)/1000;
70 
71 c = mat2cell(cm, ones(1, 10), 3);
function make_colors_stackedhist()
function fig_assert()
function draw_stacked(in x, in histss, in no_informative, in colors, in x_hint, in hint, in peakd, in flag_trace_minalt, in flag_draw_peaks, in flag_print_peaks, in flag_text)