-
Notifications
You must be signed in to change notification settings - Fork 2
/
Plot_Ensemble_Structure.m
60 lines (53 loc) · 1.39 KB
/
Plot_Ensemble_Structure.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 Plot_Ensemble_Structure(structure,name,save,colors,figure)
% Plot the structure of the ensembles, representing what are the ensembles
% each neurons belongs
%
% Plot_Ensemble_Structure(structure,name,colors,save,colors,figure)
%
% default: name = ''; save = false; colors = Read_Colors(nEnsembles)
%
% By Jesus Perez-Ortega, Feb 2020
% Modified May 2020
% Modified Jun 2020
switch nargin
case 1
name = '';
save = false;
colors = [];
figure = true;
case 2
save = false;
colors = [];
figure = true;
case 3
colors = [];
figure = true;
case 4
figure = true;
end
[nEnsembles,nNeurons] = size(structure);
structure = double(structure);
for i = 1:nEnsembles
structure(i,structure(i,:)>0) = i;
end
if isempty(colors)
colors = Read_Colors(nEnsembles);
end
% Add a row and a column to plot correctly using pcolor
structure = [[structure; zeros(1,nNeurons)]'; zeros(1,nEnsembles+1)];
% Plot structure
if figure
Set_Figure(['Structure - ' name],[0 0 40*nEnsembles 300]);
end
pcolor(structure)
colormap(gca,[1 1 1;colors])
xticks(1.5:nEnsembles+0.5)
xticklabels(1:nEnsembles)
yticks(1.5:nNeurons+0.5)
yticklabels(1:nNeurons)
ylabel('neuron #')
xlabel('ensemble #')
% Save figure
if save
Save_Figure(['Structure - ' name],'','','','1')
end