-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathContoursPlotPSTH.m
91 lines (81 loc) · 2.58 KB
/
ContoursPlotPSTH.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
function ContoursPlotPSTH(psth,cluster,target,argcatch)
%ContoursPlotPSTH Plot PSTH according to salience
%conditions
% ContoursPlotPSTH(PSTH,cluster,target,catch) where
% TARGET is either 'contour' for the contour target, or 'control'
% for the control target. CATCH is either 'catch', which means to
% plot the response to the catch trials, or 'nocatch' which means
% not to plot the response to the catch trials.
if strcmp(argcatch,'catch')
plotcatch = 1;
elseif strcmp(argcatch,'nocatch')
plotcatch = 0;
elseif strcmp(argcatch,'allcatch')
plotcatch = 2;
end
% clear the current figure
% clf
saliencesteps = size(psth.contour,2);
if plotcatch>0
numplots = saliencesteps + 1;
else
numplots = saliencesteps;
end
maxaxis = 0;
if strcmp(target,'contour')
% plot contour conditions
for si=1:saliencesteps
subplot(numplots,1,numplots-si+1),bar(psth.timebins,psth.contour(si).cluster(cluster).psth)
% get max data value
dmax = max(psth.contour(si).cluster(cluster).psth);
% find max axis value so we can plot everything on the same scale
if dmax>maxaxis
maxaxis = dmax;
end
end
if plotcatch==1
subplot(numplots,1,1),bar(psth.timebins,psth.catchcontour.cluster(cluster).psth)
% get max data value
dmax = max(psth.catchcontour.cluster(cluster).psth);
% find max axis value so we can plot everything on the same scale
if dmax>maxaxis
maxaxis = dmax;
end
end
elseif strcmp(target,'control')
% plot control conditions
for si=1:saliencesteps
subplot(numplots,1,numplots-si+1),bar(psth.timebins,psth.control(si).cluster(cluster).psth)
% get max data value
dmax = max(psth.control(si).cluster(cluster).psth);
% find max axis value so we can plot everything on the same scale
if dmax>maxaxis
maxaxis = dmax;
end
end
if plotcatch==1
subplot(numplots,1,1),bar(psth.timebins,psth.catchcontrol.cluster(cluster).psth)
% get max data value
dmax = max(psth.catchcontrol.cluster(cluster).psth);
% find max axis value so we can plot everything on the same scale
if dmax>maxaxis
maxaxis = dmax;
end
end
end
if plotcatch==2
subplot(numplots,1,1),bar(psth.timebins,psth.allcatch.cluster(cluster).psth)
% get max data value
dmax = max(psth.allcatch.cluster(cluster).psth);
% find max axis value so we can plot everything on the same scale
if dmax>maxaxis
maxaxis = dmax;
end
end
axi = axis;
% set axis to 10% more than the maxaxis
maxaxis = 1.1 * maxaxis;
% make sure all plots have the same scale
for i=1:numplots
subplot(numplots,1,i),axis([axi(1) axi(2) axi(3) maxaxis])
end