-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathplot_concentrations_paper.m
244 lines (201 loc) · 11 KB
/
plot_concentrations_paper.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
function plot_concentrations_paper(simfile,nrow,batchs)
load([simfile '.mat']);
ci=1;
names=data.ylabel;names2=names;
divi=1;divie=numel(names);
Names=names;Names2=names2;
Names=names;Names2=names2;Names=replace(Names,{'Cells' 'Nh4' 'val' 'Gly'},{'Xv ' 'NH4' 'Val' 'Glyc'});
for i=2:numel(Names)
Names{i}=[' ' Names{i}];
end
lis='a':'z';
fwidth=20.5*0.85;
fheight=26*0.85;
xlabelheight=0.7;
ylabelwidth=2;
xspaceheight=0.5;
yspacewidth=0.5;
pheight=(fheight-xlabelheight-5.5*xspaceheight)/9;
pwidth=(fwidth-ylabelwidth-yspacewidth*3.2)/5.3;
% plot_rates_pos
Pos1=[ 16-(16-1)/4*4,24-(24-1.24)/7*0,2.60849056603774,2.07222222222222;
16-(16-1)/4*4,24-(24-1.24)/7*1,2.60849056603774,2.07222222222222;
16-(16-1)/4*4,24-(24-1.24)/7*2,2.60849056603774,2.07222222222222;
16-(16-1)/4*4,24-(24-1.24)/7*3,2.60849056603774,2.07222222222222;
16-(16-1)/4*4,24-(24-1.24)/7*4,2.60849056603774,2.07222222222222;
16-(16-1)/4*4,24-(24-1.24)/7*5,2.60849056603774,2.07222222222222;
16-(16-1)/4*4,24-(24-1.24)/7*6,2.60849056603774,2.07222222222222;
16-(16-1)/4*4,24-(24-1.24)/7*7,2.60849056603774,2.07222222222222];
Pos2=[ 16-(16-1)/4*3,24-(24-1.24)/7*0,2.60849056603774,2.07222222222222;
16-(16-1)/4*3,24-(24-1.24)/7*1,2.60849056603774,2.07222222222222;
16-(16-1)/4*3,24-(24-1.24)/7*2,2.60849056603774,2.07222222222222;
16-(16-1)/4*3,24-(24-1.24)/7*3,2.60849056603774,2.07222222222222;
16-(16-1)/4*3,24-(24-1.24)/7*4,2.60849056603774,2.07222222222222;
16-(16-1)/4*3,24-(24-1.24)/7*5,2.60849056603774,2.07222222222222;
16-(16-1)/4*3,24-(24-1.24)/7*6,2.60849056603774,2.07222222222222;
16-(16-1)/4*3,24-(24-1.24)/7*7,2.60849056603774,2.07222222222222];
Pos3=[ 16-(16-1)/4*2,24-(24-1.24)/7*0,2.60849056603774,2.07222222222222;
16-(16-1)/4*2,24-(24-1.24)/7*1,2.60849056603774,2.07222222222222;
16-(16-1)/4*2,24-(24-1.24)/7*2,2.60849056603774,2.07222222222222;
16-(16-1)/4*2,24-(24-1.24)/7*3,2.60849056603774,2.07222222222222;
16-(16-1)/4*2,24-(24-1.24)/7*4,2.60849056603774,2.07222222222222;
16-(16-1)/4*2,24-(24-1.24)/7*5,2.60849056603774,2.07222222222222;
16-(16-1)/4*2,24-(24-1.24)/7*6,2.60849056603774,2.07222222222222;
16-(16-1)/4*2,24-(24-1.24)/7*7,2.60849056603774,2.07222222222222];
Pos4=[ 16-(16-1)/4*1,24-(24-1.24)/7*0,2.60849056603774,2.07222222222222;
16-(16-1)/4*1,24-(24-1.24)/7*1,2.60849056603774,2.07222222222222;
16-(16-1)/4*1,24-(24-1.24)/7*2,2.60849056603774,2.07222222222222;
16-(16-1)/4*1,24-(24-1.24)/7*3,2.60849056603774,2.07222222222222;
16-(16-1)/4*1,24-(24-1.24)/7*4,2.60849056603774,2.07222222222222;
16-(16-1)/4*1,24-(24-1.24)/7*5,2.60849056603774,2.07222222222222;
16-(16-1)/4*1,24-(24-1.24)/7*6,2.60849056603774,2.07222222222222;
16-(16-1)/4*1,24-(24-1.24)/7*7,2.60849056603774,2.07222222222222];
Pos5=[16-(16-1)/4*0,24-(24-1.24)/7*0,2.60849056603774,2.07222222222222;
16-(16-1)/4*0,24-(24-1.24)/7*1,2.60849056603774,2.07222222222222;
16-(16-1)/4*0,24-(24-1.24)/7*2,2.60849056603774,2.07222222222222;
16-(16-1)/4*0,24-(24-1.24)/7*3,2.60849056603774,2.07222222222222;
16-(16-1)/4*0,24-(24-1.24)/7*4,2.60849056603774,2.07222222222222;
16-(16-1)/4*0,24-(24-1.24)/7*5,2.60849056603774,2.07222222222222;
16-(16-1)/4*0,24-(24-1.24)/7*6,2.60849056603774,2.07222222222222;
16-(16-1)/4*0,24-(24-1.24)/7*7,2.60849056603774,2.07222222222222];
Pos10=Pos1;Pos20=Pos2;Pos30=Pos3;Pos40=Pos4;Pos50=Pos5;
c=prism(20);
% normalize conc
% y=[];ysim=[];
% for ib=batchs
% y=[y;data.batch(ib).y];ysim=[ysim;data.batch(ib).ysim];
% end
% for ib=batchs
% data.batch(ib).y=data.batch(ib).y./max(y);
% data.batch(ib).ysim=data.batch(ib).ysim./max(ysim);
% end
for ic=1:ci
Pos1=Pos10;Pos2=Pos20;Pos3=Pos30;Pos4=Pos40;Pos5=Pos50;
names=Names(divi(ic):divie(ic));names2=Names2(divi(ic):divie(ic));
max_c=7-ceil(numel(names)/nrow)+2;
Pos1=Pos1(max_c:end,:);Pos2=Pos2(max_c:end,:);Pos3=Pos3(max_c:end,:);Pos4=Pos4(max_c:end,:);Pos5=Pos5(max_c:end,:);
hFig = figure;
set(hFig, 'Color', 'w',...
'paperpositionmode', 'auto',...
'paperunits', 'centimeters',...
'paperposition', [0.5 1. 31*0.86 40*0.85],...
'units', 'centimeters',...
'position', [0.5 1.5 17.5*0.86 27.2*0.85]);
%[0,0.64,1]=[0,0.8,0.8];
fwidth=20.5*0.85;
fheight=26*0.85;
xlabelheight=0.7;
ylabelwidth=2;
xspaceheight=0.5;
yspacewidth=0.5;
pheight=(fheight-xlabelheight-5.5*xspaceheight)/9;
pwidth=(fwidth-ylabelwidth-yspacewidth*3.2)/5.3;
id=0;
np=numel(names);
train=[];test=[];
for ib=batchs
if data.batch(ib).istrain==1
train=[train ib];
else
test=[test ib];
end
end
end
try
for i=1:7 % rows
maxys=[];maxxs=[];
for row=1:nrow %coolumns
if row==1; position=Pos1(i,:);elseif row==2;position=Pos2(i,:);elseif row==3;position=Pos3(i,:);elseif row==4;position=Pos4(i,:);else; position=Pos5(i,:);end
id=id+1;if id>np;error;end
hAx1t=axes('Parent', hFig,'XColor',[1 1 1],'YColor',[1 1 1 ]);
set(hAx1t,'Units','centimeters','position',position,'YTickLabel',[],'XTickLabel',[]);
hAx1=axes('Parent', hFig,'Color','none');
hold(hAx1,'on');hold on;
maxy1=-inf;miny1=inf; maxx1=-inf;minx1=inf;
for ib=batchs
x = data.age_h';
y1=data.batch(ib).y(:,id);e=y1;if id==1;e=e*0.1;else;e=e*0.2;end
y = data.batch(ib).ysim(:,id);
maxy1=max([maxy1;y]);miny1=min([miny1;y]);maxx1=max([maxx1;x]);minx1=min([minx1;x]);
if data.batch(ib).istrain==1
experimentalPlot = errorbar(x,y1,e,...
'MarkerSize',2,'Color','#0080ff','Marker','o','LineStyle','none','Linewidth',1,'HandleVisibility','off');
trainingPlot = plot(x,y,...
'Color','#0080ff','Marker','none','LineStyle','-','Linewidth',2,'HandleVisibility','off');
else
end
end
maxys(row)=maxy1;maxxs(row)=maxx1;
for ib=batchs
x = data.age_h';
y = data.batch(ib).ysim(:,id);
y1=data.batch(ib).y(:,id);e=y1;if id==1;e=e*0.1;else;e=e*0.2;end
if data.batch(ib).istrain==1
else
experimentalPlot = errorbar(x,y1,e,...
'MarkerSize',2,'Color','#2bbf5c','Marker','o','LineStyle','none','Linewidth',1,'HandleVisibility','off');
testPlot = plot(x,y,...
'Color','#2bbf5c','Marker','none','LineStyle','-','Linewidth',2,'HandleVisibility','off');
end
end
if id==np
il=[];
if ~isempty(train)
il=[il 1 2];
x = data.age_h';
y1=data.batch(ib).y(:,id);e=y1;if id==1;e=e*0.1;else;e=e*0.2;end
experimentalPlot = errorbar(x,y1,e,...
'MarkerSize',2,'Color','#0080ff','Marker','o','LineStyle','none','Linewidth',1,'HandleVisibility','on');
y = data.batch(train(1)).ysim(:,id);
trainingPlot = plot(x,y,...
'Color','#0080ff','Marker','none','LineStyle','-','Linewidth',2,'HandleVisibility','on');
end
if ~isempty(test)
il=[il 3 4];
x = data.age_h';
y1=data.batch(ib).y(:,id);e=y1;if id==1;e=e*0.1;else;e=e*0.2;end
experimentalPlot = errorbar(x,y1,e,...
'MarkerSize',2,'Color','#2bbf5c','Marker','o','LineStyle','none','Linewidth',1,'HandleVisibility','on');
y = data.batch(test(1)).ysim(:,id);st='on';
testPlot = plot(x,y,...
'Color','#2bbf5c','Marker','none','LineStyle','-','Linewidth',2,'HandleVisibility','on');
end
% if numel(il)>3;il=il(1:3);end
lg={'experimental' 'train' 'experimental' 'test' };
legend(lg(il),'Location', 'north','FontSize',7,'FontName','Arial')
end
% pl=line([48.1667 48.1667],[min([0 maxy1]) max([ maxy1] )]*1.3,'LineStyle','-','LineWidth',1.1);
% pl=line([48.1667+12 48.1667+12],[min([0 maxy1]) max([ maxy1] )]*1.3,'LineStyle','-','LineWidth',1.1);
miny1=miny1-abs(mean([miny1 maxy1]))*1;maxy1=maxy1+abs(mean([miny1 maxy1]))*1;
ylim(hAx1,[ 0 max([maxy1])*1.25])
xlim(hAx1,[ 0 max([maxx1])*1.15])
axis square
% if np-id>nrow-1
set(hAx1,'Units','centimeters','position',position,'Box','on','YMinorGrid','off','XMinorGrid','off','FontSize',8,'FontName','Arial');hold on;
% else
% set(hAx1,'Units','centimeters','position',position,'Box','on','YMinorGrid','off','XMinorGrid','off','FontSize',7,'FontName','Arial');hold on;
%
% end
hAx = gca; % handle to current axes
if id~=1
ylabel([Names{id}],'FontSize',8,'interpreter','tex','FontName','Arial','FontWeight','bold');
else
ylabel([' ' Names{id} ' '],'FontSize',8,'interpreter','tex','FontName','Arial','FontWeight','bold');
end
xlabel('Time (h)','FontSize',8,'FontName','Arial','FontWeight','bold');
n=names2{id};
set(gca,'FontSize',8);
yrange=max([maxy1])-min([miny1 ]);
xrange=max([ maxx1])-min([ minx1]);
text(min([ minx1])+xrange*0.75,min([miny1 ])+yrange*1.15,[lis((i)) num2str(row) ' '],'HorizontalAlignment','right','VerticalAlignment','top','FontSize',9,'FontName','Arial','FontWeight','bold')
set(gca,'FontWeight','bold')
end
if ic>1 && i==5
6;
end
ids=(i-1)*row+1:(i-1)*row+row;
end
catch kl
1;
end
end