-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpsr_lfp_plot_bpw.m
75 lines (60 loc) · 1.9 KB
/
psr_lfp_plot_bpw.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
function h = psr_lfp_plot_bpw(bandpwr,parameters)
% PSR_LFP_PLOT_BPW - Plot bandpower figure
%
% Syntax: h = psr_lfp_plot_bpw(bandpwr,parameters)
%
% Inputs:
% bandpwr - Bandpower array, output from PSR_LFP_BANDPOWER or PSR_LFP_BPW
% parameters - See PSR_PARAMETERS_ANALYSIS
%
% Outputs:
% h - Handle for bandpower plot
%
% See also: PSR_LFP_BANDPOWER, PSR_LFP_BPW
% PASER: Processing and Analysis Schemes for Extracellular Recordings
% https://github.com/tbrouns/paser
% Author: Terence Brouns
% Radboud University, Neurophysiology Dept.
% E-mail address: [email protected]
% Date: 2018
%------------- BEGIN CODE --------------
nTrials = size(bandpwr,1);
alpha = parameters.analysis.bpw.plot.alpha;
color = parameters.analysis.bpw.plot.color;
frange = parameters.analysis.bpw.frange;
nrange = size(frange,1);
x = 1:nrange;
y = mean(bandpwr,1);
z = [];
switch parameters.analysis.bpw.plot.error
case 'std'; z = std(bandpwr,[],1);
case 'sem'; z = std(bandpwr,[],1) / sqrt(nTrials);
end
x = x';
y = y';
z = z';
h = plot(x,y,'-o','Color',color,'MarkerEdgeColor',color,'MarkerFaceColor',color);
if ~isempty(z)
hold on;
plot_ci(x,[y,(y - z),(y + z)], ...
'PatchColor', color, ...
'PatchAlpha', alpha, ...
'MainLineStyle', '-', ...
'MainLineWidth', 1.0, ...
'MainLineColor', color, ...
'LineColor', color, ...
'LineStyle', 'none');
hold off;
end
xlabel('$\bf{Frequency [Hz]}$', 'Interpreter','Latex');
ylabel('$\bf{Relative \ power}$','Interpreter','Latex');
set(gca,'TickLabelInterpreter','Latex');
xlim([min(x)-1 max(x)+1]);
xticks(x);
xTicks = cell(0,0);
for iRange = 1:nrange
xTicks{1,iRange} = [num2str(frange(iRange,1)) ' - ' num2str(frange(iRange,2))];
end
xticklabels(xTicks);
if (~isempty_field(parameters,'parameters.analysis.bpw.plot.plim')); ylim(parameters.analysis.bpw.plot.plim); end
end