-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_mean_std.m
More file actions
60 lines (59 loc) · 2.28 KB
/
plot_mean_std.m
File metadata and controls
60 lines (59 loc) · 2.28 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
% Plot Time Scores
% for N Inputs of AIMs Scores
% and Colors
function plot_mean_std(ColorsALL,Labels,KindofAIMs,bartype,varargin)
N=numel(varargin);
TimeAxis=[0:20:180];
% TimeAxis=[1:9];
AIMsTime=figure('Name',['Mean & ',bartype,' of ',KindofAIMs,' AIMs'],'NumberTitle','off');
AIMsAxis=subplot(1,1,1);
Radius=2;
miniBar=0.5;
MaxAIM=0;
for n=1:N
X=[zeros(size(varargin{n},1),1),varargin{n}];
Nmice=size(X,1);
Means=mean(X);
STDs=std(X);
SEM=STDs/sqrt(Nmice);
LinesPlots(n)=plot(AIMsAxis,TimeAxis,Means,'Color','k','LineWidth',4,...
'Color',ColorsALL(n,:));
hold(AIMsAxis,'on')
for t=1:10
% Mean CIRCLES ******************************************
Position=[TimeAxis(t)-Radius,Means(t)-Radius/2,2*Radius,Radius];
rectangle('Position',Position,'Curvature',[1 1],...
'FaceColor',ColorsALL(n,:),'LineWidth',2)
% Error BARS ******************************
switch bartype
case 'SEM'
plot([TimeAxis(t),TimeAxis(t)],[Means(t)-SEM(t),Means(t)+SEM(t)],...
'Color','k')
% Mini Upper and Lower Bars
plot([TimeAxis(t)-miniBar,TimeAxis(t)+miniBar],...
[Means(t)+SEM(t),Means(t)+SEM(t)],'Color','k','LineWidth',1.5)
plot([TimeAxis(t)-miniBar,TimeAxis(t)+miniBar],...
[Means(t)-SEM(t),Means(t)-SEM(t)],'Color','k','LineWidth',1.5)
if max(Means+SEM)>MaxAIM
MaxAIM=max(Means+SEM);
end
case 'STD'
plot([TimeAxis(t),TimeAxis(t)],[Means(t)-STDs(t),Means(t)+STDs(t)],...
'Color','k')
% Mini Upper and Lower Bars
plot([TimeAxis(t)-miniBar,TimeAxis(t)+miniBar],...
[Means(t)+STD(t),Means(t)+SEM(t)],'Color','k','LineWidth',1.5)
plot([TimeAxis(t)-miniBar,TimeAxis(t)+miniBar],...
[Means(t)-STD(t),Means(t)-SEM(t)],'Color','k','LineWidth',1.5)
if max(Means+STDs)>MaxAIM
MaxAIM=max(Means+STDs);
end
end
end
end
legend(LinesPlots,Labels);
grid(AIMsAxis,'on');
AIMsAxis.YLim=[-Radius,10*ceil(MaxAIM/10)];
AIMsAxis.XLim=[-Radius,200];
AIMsAxis.XTickLabel=0:20:200;
disp('>>Ready')