-
Notifications
You must be signed in to change notification settings - Fork 0
/
NottinghamPhagePlotSeries.m
151 lines (118 loc) · 4.54 KB
/
NottinghamPhagePlotSeries.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
function NottinghamPhagePlotSeries(graphSpecies, simTimes, ...
splitPlots, cutPoint, distances, savePlot, baseFile)
% Plot the array of values for each species in each scenario.
%
% Shows a range of species values that can arised from the accepted
% parameters
%
% function NottinghamPhagePlotSeries(graphSpecies, simTimes, ...
% splitPlots, cutPoint, distances, savePlot, baseFile)
%
% graphSpecies - Data to plot
% simTimes - The times whose values are wanted
% splitPlot - Should we split plots that match double data from those
% that do not?
% cutPoint - distance above which data is not considered a good match
% distances - distances to double predator data
% savePlot - Should the plots be saved
% baseFile - File Names for plots
% Version Author Date Affiliation
% 1.00 J K Summers 10/10/17 Kreft Lab - School of Biosciences -
% University of Birmingham
% 1.02 J K Summers 27/10/17 Take species values to plot as a
% parameter
tic
scenarioTitles = {'Prey only', 'Prey + Bd', 'Prey + phage', 'All'};
speciesTitles = {'Substrate', 'Prey', 'Bdellovibrio', 'Halophage'};
for j = 1:4
for i = 1:4
curData = graphSpecies(:, :, j, i);
if splitPlots
plotTitle = ['Single ' scenarioTitles{j} ' ' speciesTitles{i}];
fileName = [baseFile 'Single ' scenarioTitles{j} ' ' ...
speciesTitles{i}];
else
plotTitle = [scenarioTitles{j} ' ' speciesTitles{i}];
fileName = [baseFile ' ' scenarioTitles{j} ' ' ...
speciesTitles{i}];
end
fig = figure;
for k = 1:size(graphSpecies, 1)
if splitPlots
if distances(k) > cutPoint
plot(simTimes, curData(k, :));
end
else
plot(simTimes, curData(k, :));
end
hold on
end
set(gca, 'YScale', 'log');
axis square;
ax = gca; % current axes
ax.FontSize = 28;
ax.LineWidth = 1.2;
ax.TickDir = 'out';
ax.TickLength = [0.02 0.02];
xlim([simTimes(1) simTimes(size(simTimes, 1))])
ylim([1, 1e11])
title(plotTitle, 'FontSize', 12);
xlabel('Time (hours)', 'FontSize', 12, 'FontWeight', 'bold');
ylabel('Species per ml', 'FontSize', 12, 'FontWeight', 'bold');
if savePlot
% Save the figure
fig.PaperUnits = 'centimeter';
fig.PaperPosition = [2 2 17 17];
fig.PaperPositionMode = 'manual';
figSaveName = [fileName '.pdf'];
print(fig, figSaveName, '-dpdf', '-r600')
figSaveName = [fileName '.fig'];
savefig(fig, figSaveName)
figSaveName = [fileName '.png'];
print(fig, figSaveName, '-dpng', '-r600')
end
end
end
if splitPlots
for j = 1:4
for i = 1:4
curData = graphSpecies(:, :, j, i);
plotTitle = ['Double ' scenarioTitles{j} ' ' speciesTitles{i}];
fileName = [baseFile 'Double ' scenarioTitles{j} ' ' ...
speciesTitles{i}];
fig = figure;
for k = 1:size(plotSpecies, 1)
if distances(k) < cutPoint
plot(simTimes, curData(k, :));
end
hold on
end
set(gca, 'YScale', 'log');
axis square;
ax = gca; % current axes
ax.FontSize = 10;
ax.LineWidth = 1.2;
ax.TickDir = 'out';
ax.TickLength = [0.02 0.02];
xlim([simTimes(1) simTimes(size(simTimes, 2))])
ylim([1, 1e11])
title(plotTitle, 'FontSize', 12);
xlabel('Time (hours)', 'FontSize', 12, 'FontWeight', 'bold');
ylabel('Species per ml', 'FontSize', 12, 'FontWeight', 'bold');
if savePlot
% Save the figure
fig.PaperUnits = 'centimeter';
fig.PaperPosition = [2 2 17 17];
fig.PaperPositionMode = 'manual';
figSaveName = [fileName '.pdf'];
print(fig, figSaveName, '-dpdf', '-r600')
figSaveName = [fileName '.fig'];
savefig(fig, figSaveName)
figSaveName = [fileName '.png'];
print(fig, figSaveName, '-dpng', '-r600')
end
end
end
end
toc
end