[37] | 1 | function o = graph_results(ifile, means, stds, ylabs,logscale) |
---|
| 2 | % This will take two matrices with means and Standard deviations. |
---|
| 3 | % We assume each row will be a single graph. |
---|
| 4 | padpercent = .1; |
---|
| 5 | % I'm going to pad the max and min values that I want visible in |
---|
| 6 | % the graph by this percent, so they don't touch the top and bottom. |
---|
| 7 | if logscale
|
---|
| 8 | if ~isempty(stds) |
---|
| 9 | stds_low = log(means - stds); |
---|
| 10 | stds_hi = log(means + stds);
|
---|
| 11 | end
|
---|
| 12 | means = log(means); |
---|
| 13 | ylabs = log(ylabs); |
---|
| 14 | else
|
---|
| 15 | if ~isempty(stds) |
---|
| 16 | stds_low = means - stds; |
---|
| 17 | stds_hi = means + stds;
|
---|
| 18 | end |
---|
| 19 | end |
---|
| 20 |
|
---|
| 21 | if isempty(stds)
|
---|
| 22 | minval = min(min(ylabs),min(min(means)));
|
---|
| 23 | maxval = max(max(means));
|
---|
| 24 | else |
---|
| 25 | minval = min(min(stds_low)); |
---|
| 26 | maxval = max(max(stds_hi));
|
---|
| 27 | end |
---|
| 28 | range = maxval - minval; |
---|
| 29 | |
---|
| 30 | padded_minval = max(0,minval - padpercent*range); |
---|
| 31 | padded_maxval = maxval + padpercent*range; |
---|
| 32 | |
---|
| 33 | for i = 1:size(means,1) |
---|
| 34 | mean_row = means(i,:);
|
---|
| 35 | if ~isempty(stds) |
---|
| 36 | std_low_row = stds_low(i,:); |
---|
| 37 | std_hi_row = stds_hi(i,:);
|
---|
| 38 | else
|
---|
| 39 | std_low_row = [];
|
---|
| 40 | std_hi_row = [];
|
---|
| 41 | end |
---|
| 42 | graph_idraw(ifile, mean_row, std_low_row, std_hi_row, padded_minval, padded_maxval); |
---|
| 43 | end |
---|
| 44 | |
---|
| 45 | label_graph(ifile, 1:size(means,2), 0, 1 + size(means,2), ylabs, padded_minval, padded_maxval); |
---|
| 46 | o=1; |
---|