-
Notifications
You must be signed in to change notification settings - Fork 0
/
BoxPlotSensitivities.m
113 lines (93 loc) · 3.07 KB
/
BoxPlotSensitivities.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
function BoxPlotSensitivities(sens, params, tit, outliers, rmInf, save, ...
fileName)
% Creates a box plot of the sensitivity data supplied
%
% function BoxPlotSensitivities(sens, params, tit, outliers, rmInf, save, ...
% fileName)
%
% sens - the senstivity data to display
% params - the parameters that were varied to observe sensitivities
% tit - the title for the plot
% outliers - should outliers be displayed
% rmInf - should any infinities be removed (and replaced with the
% largest non-infinite value)
% save - should the plot be saved
% fileName - the filename to save the plot as
% Version Author Date Affiliation
% 1.00 J K Summers 03/08/16 Kreft Lab - School of Biosciences -
% University of Birmingham
% 1.01 J K Summers 25/01/18 Also save files in png and fig format
if rmInf
for i = 1:size(sens, 2)
if max(sens(:, i)) <= 0
minSens = min(sens(sens(:, i) ~= Inf, i));
sens(sens(:, i) == Inf, i) = minSens;
else
% Remove all values of infinity and replace with the largest
% non-infinite value
maxSens = max(sens(sens(:, i) ~= Inf, i));
sens(sens(:, i) == Inf, i) = maxSens;
end
end
end
if outliers
fig = figure;
handler = boxplot1(sens, params);
view(90, 90)
set(handler, 'linewidth', 2);
ax = gca; % current axes
ax.FontSize = 12;
ax.LineWidth = 1.2;
ax.TickDir = 'out';
ax.TickLength = [0.02 0.02];
ax.YLabel.String = 'Percentage Sensitivity';
title({tit, ''}, 'FontSize', 16);
if save
% Save the figure
fig.PaperUnits = 'centimeter';
fig.PaperPosition = [2 2 17 17];
fig.PaperPositionMode = 'manual';
figFileName =[fileName 'outlier.pdf'];
print(fig, figFileName, '-dpdf', '-r600')
figFileName =[fileName 'outlier.png'];
print(fig, figFileName, '-dpng', '-r600')
figFileName = [fileName 'outlier.fig'];
savefig(fig, figFileName);
end
end
yMaxs = zeros(size(sens, 2), 1);
yMins = zeros(size(sens, 2), 1);
for i = 1:size(sens, 2)
yMins(i) = quantile(sens(:, i), 0.25);
yMaxs(i) = quantile(sens(:, i), 0.75);
end
yMin = min(yMins);
yMax = max(yMaxs);
fig = figure;
handler = boxplot1(sens, params, 'whisker', 0);%, 'symbol', [0.1 0.2 1 '+']);
view(90, 90)
set(handler, 'linewidth', 2);
h = findobj(gca, 'tag', 'Outliers');
delete(h);
%axis square;
ylim([yMin - 1 yMax + 1]);
ax = gca; % current axes
ax.FontSize = 12;
ax.LineWidth = 1.2;
ax.TickDir = 'out';
ax.TickLength = [0.02 0.02];
title({tit, ''}, 'FontSize', 16);
ax.YLabel.String = 'Percentage Sensitivity';
if save
% Save the figure
fig.PaperUnits = 'centimeter';
fig.PaperPosition = [2 2 17 17];
fig.PaperPositionMode = 'manual';
figFileName =[fileName '.pdf'];
print(fig, figFileName, '-dpdf', '-r600')
figFileName =[fileName '.png'];
print(fig, figFileName, '-dpng', '-r600')
figFileName = [fileName '.fig'];
savefig(fig, figFileName);
end
end