IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
draw_hachure2.m
Go to the documentation of this file.
1 %>@ingroup graphicsapi idata
2 %> @file
3 %> @brief Draws hachure
4 %>
5 %> This hachure typically represents confidence intervals, prediction intervals, or standard deviations.
6 %>
7 %> The hachures interfere with the line width of the axes and legend border - weird but this is a MATLAB's problem
8 %
9 %> @param xaxis
10 %> @param intervals must be a [2]x[number of points] vector with one interval in each column, where the first element is the lower value
11 %> @param color
12 function draw_hachure2(xaxis, intervals, color)
13 
14 
15 % Some tolerance in the shape of the inputs
16 xaxis = xaxis(:)'; % Makes sure xaxis is a row vector
17 
18 
19 if size(intervals, 1) ~= 2
20  irerror('"intervals" must be a 2-row vector!');
21 end;
22 
23 if intervals(1, 1) > intervals(2, 1)
24  irerror('First row of "intervals" must contain the lower values!');
25 end;
26 
27 xx = [xaxis, xaxis(end:-1:1)];
28 yy = [intervals(1, :), intervals(2, end:-1:1)];
29 fill(xx, yy, color, 'LineStyle', '-', 'FaceAlpha', 0.25, 'EdgeColor', color, 'LineWidth', scaled(1), 'EdgeAlpha', 0.8);
function irerror(in s)
function scaled(in i)