-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakeMapFromArray.m
More file actions
46 lines (35 loc) · 1.09 KB
/
makeMapFromArray.m
File metadata and controls
46 lines (35 loc) · 1.09 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
function makeMapFromArray(plotOutputData,toPlotArray)
%makes a region-labelled plot of the variable of one's choice.
%Inputs:
% plotOutputData -> output data structure from makeOutputPlots.m
% toPlotArray -> N x 1 or numRegions x 1 array containing region
% colorings. If an N x 1 array is inputted, the mean
% value within region is used
%
%
% (C) Gordon J. Berman, 2016
% Emory University
addpath('utilities/');
L = plotOutputData.watershedMap;
M = plotOutputData.numRegions;
A = zeros(size(L));
for i=1:M
if length(toPlotArray) == M
A(L == i) = toPlotArray(i);
else
A(L == i) = mean(toPlotArray(plotOutputData.watershedRegions == i));
end
end
xx = plotOutputData.xx;
imagesc(xx,xx,A);
axis equal tight off xy
hold on
for i=1:M
B = bwboundaries(L == i);
plot(xx(B{1}(:,2)),xx(B{1}(:,1)),'k-','linewidth',2)
end
colorbar
set(gca,'fontsize',14,'fontweight','bold')
load('saved_colormaps');
colormap(cc)
hold off