-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap_plot.m
More file actions
53 lines (44 loc) · 1.67 KB
/
map_plot.m
File metadata and controls
53 lines (44 loc) · 1.67 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
function map_plot(data_in,varargin)
%if the
figure
if nargin > 2
switch varargin{2}
case 0 %standard plot the matrix directly
imagesc(data_in)
colorbar
case 1 %plot the E/I overlap
% %binarize the maps
% bin_map = data_in>0;
bin_map = data_in;
%define the smooth factor
sf = 1;
%generate a blank matrix to fill in the other color channels
blank = ones(size(bin_map,1),size(bin_map,2));
%set the excitation map as a red image, smoothing by sf
exc_map = imresize(cat(3,blank,1-normr_2(bin_map(:,:,1)),1-normr_2(bin_map(:,:,1))),sf);
%and the inhibition map as a blue one
inh_map = imresize(cat(3,1-normr_2(bin_map(:,:,2)),1-normr_2(bin_map(:,:,2)),blank),sf);
% %blend the two images using alpha (and make it double cause default is 8bit
im_ex = double(imfuse(exc_map,inh_map,'method','blend'));
%normalize the image
im_ex = normr_2(im_ex);
%remove the NaNs (if there was an empty channel)
im_ex(isnan(im_ex)) = 0;
%plot the image
imagesc(im_ex)
end
else
%standard plot the matrix directly
imagesc(data_in)
colorbar
end
%add the lines and labels for the layers
hold('on')
set(gca,'YTick',[1.5, 4.5, 8, 13],'YTickLabels',{'L1','L2/3','L4','DL'},...
'TickLength',[0 0],'XTick',[])
plot(0:17,2.5.*ones(1,18),'k-')
plot(0:17,6.5.*ones(1,18),'k-')
plot(0:17,9.5.*ones(1,18),'k-')
if nargin > 1
title(varargin{1})
end