-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphWeights.m
More file actions
46 lines (45 loc) · 1.42 KB
/
GraphWeights.m
File metadata and controls
46 lines (45 loc) · 1.42 KB
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
function weightGraph = GraphWeights(GSD, BBIds, numDays, BadIdxs, i)
ymin = 15;
ymax = 36;
weightData = GSD(i).weight;
str = sprintf('BB%g Daily Weights',str2double(GSD(i).BBName));
time = linspace(1,numDays,numDays);
if i == size(GSD,2)
str = 'Average Daily Weights-- CorticosteronexKetamine';
for i = 1:size(BBIds,2)
fullWeightData(:, i) = GSD(i).weight;
end
for j = 1:size(fullWeightData,1)
err(j) = std(fullWeightData(j,:));
end
else
err = (zeros(size(time,2,1)) + 0.2)';
end
weightGraph = figure('Name', str);
weightData(BadIdxs) = NaN;
err(BadIdxs) = 0;
xSpacer = 0.5:3:size(weightData);
hold on
title(str)
xlabel('Day');
ylabel('Weight (g)');
plot(time, smooth(weightData), 'r-');
errorbar(time, weightData, err, 'r.');
for i = 1:size(BadIdxs,2)
plot(BadIdxs(i),ymin,'green*');
end
legend('Weight (g)','AutoUpdate','off');
for i = 1:(size(xSpacer,2))
xval = xSpacer(i);
xline(xval);
end
xline(14, '-', {'Ketamine', 'Injection'});
%if p <= 0.05
%text(.6 * max([weightData]), .6 * max([weightData]), ['* p = ' num2str(p)])
%else
%text(.6 * max([weightData; weightData]), .6 * max([weightData; weightData]), ['p = ' num2str(p)])
%end
xlim([0 numDays])
ylim([ymin ymax])
hold off
end