-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_rasterSpeechTaskTrialPauseOrder.m
More file actions
55 lines (47 loc) · 2.04 KB
/
plot_rasterSpeechTaskTrialPauseOrder.m
File metadata and controls
55 lines (47 loc) · 2.04 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
function [ fh ] = plot_rasterSpeechTaskTrialPauseOrder( figdir, figtitle, Stim, Trial, trange, BurstColor, order, markers, MarkerColor )
%UNTITLED6 Summary of this function goes here
% Detailed explanation goes here
%respWind = round(respInterval(1)*spkSampRate):round(respInterval(2)*spkSampRate);
plott = linspace(Stim.respInterval(1),Stim.respInterval(2),size(Stim.DD,2));
[fh, rasterh, meanh, ~, labelh] = makeRasterIFRplot(figtitle);
if isempty(BurstColor)
colormap parula;
cm = colormap+(1-colormap)*0.5;
ncolor = size(cm,1);
mpp = max([Trial.PP.S]);
BurstColor = arrayfun(@(x) cm(find(x<=linspace(0,mpp,ncolor),1,'first'),:), ...
[Trial.PP(:).S],...
'uniformoutput', false);
else
BurstColor = arrayfun(@(x) BurstColor, 1:size(Stim.DD,1), ...
'uniformoutput', false);
end
k=0;
for i = order'%1:size(Stim.DD,1)
k=k+1;
if ~isempty(Trial.PP(i).ii)
indD = find(Trial.DD{i});
rectangle('Parent',rasterh,'Position', ...
[Trial.timeCue{i}(indD(Trial.PP(i).ii(1))), ...
k, ...
Trial.timeCue{i}(indD(Trial.PP(i).ii(end)+1))-Trial.timeCue{i}(indD(Trial.PP(i).ii(1))), ...
0.9], ...
'FaceColor',BurstColor{i},'EdgeColor',BurstColor{i});
end
if ~isempty(markers)
line('Parent',rasterh,'XData',markers(i)*[1 1],...
'YData',[k (k+0.9)], 'LineWidth', 3, 'color', MarkerColor);
end
end
plotRastersandIFRs(plott, meanh, Stim.meanifr, Stim.stdifr, rasterh, Stim.DD(order,:), 0, [0 0 0]);
plot(rasterh, [0 0], [0 length(trange)], 'Color', [.4 .4 .4], 'LineWidth', 2);
plot(meanh, [0 0], meanh.YLim, 'Color', [.4 .4 .4], 'LineWidth', 2);
rasterh.XLim = [plott(1) plott(end)];
meanh.XLim = [plott(1) plott(end)];
plot(meanh, meanh.XLim, Stim.baseIFRCI(1)*[1 1], 'r');
plot(meanh, meanh.XLim, Stim.baseIFRCI(2)*[1 1], 'r');
plot(meanh, plott, meanh.YLim(2)*Stim.sig_excit, 'r', 'LineWidth', 3);
plot(meanh, plott, meanh.YLim(2)*Stim.sig_inhib, 'b', 'LineWidth', 3);
saveas(fh,[figdir,'/',figtitle,'.pdf'], 'pdf');
close(fh);
end