-
Notifications
You must be signed in to change notification settings - Fork 9
/
comodulogram.m
60 lines (53 loc) · 2.04 KB
/
comodulogram.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
function h = comodulogram(freqs_phase,freqs_amp,pacval,varargin)
icadefs;
h = [];
if nargin < 3
help comodulogram;
return;
end
g = finputcheck( varargin, { ...
'signifmask' 'integer' [ ] [];
'alphadata' 'integer' [] 0.5;
'title' 'string' '' 'Modulation Index';
'shading' 'string' {'flat', 'faceted'} 'flat';
'scale' 'string' {'linear' 'log'} 'log'});
h = figure('Name', g.title,'Units','Normalized','Tag','comod_plot');
haxes = axes('parent',h,'Units', 'Normalized','ActivePositionProperty', 'outerposition');
pcolor(freqs_phase, freqs_amp, pacval');
% shading(haxes,g.shading); % shading data
colormap(haxes,'parula'); % Colormap
% Scale
if strcmp(g.scale, 'log')
set(haxes, 'XScale', 'log');
set(haxes, 'YScale', 'log');
else
set(haxes, 'XScale', 'linear');
set(haxes, 'YScale', 'linear');
end
title(haxes, sprintf(g.title)); % Title
colorbar(haxes); % colorbar
% Axis labels
xlabel(haxes,'Phase Frequency [Hz]');
ylabel(haxes,'Amplitude Frequency [Hz]');
set(get(h,'Children'),'Fontsize',AXES_FONTSIZE_L+5);
% Plot significance mask
if ~isempty(g.signifmask)
haxes2 = axes('Position',haxes.Position,'XTick',[],'YTick',[],'XTickLabel','','YTickLabel','');
haxes2.ActivePositionProperty = 'outerposition';
haxes2.Visible = 'off';
linkaxes([haxes,haxes2]);
h_trans = pcolor(freqs_phase, freqs_amp,int8(g.signifmask)', 'parent', haxes2);
if strcmp(g.scale, 'log')
set(haxes2, 'XScale', 'log');
set(haxes2, 'YScale', 'log');
else
set(haxes2, 'XScale', 'linear');
set(haxes2, 'YScale', 'linear');
end
set(h_trans,'FaceAlpha',g.alphadata);
set(haxes2,'Color','None','XTick',[],'YTick',[],'XTickLabel','','YTickLabel','')
colormap(haxes,'parula');
colormap(haxes2,'gray');
end
box on; grid on;
end