-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfig_subway10_map.m
182 lines (130 loc) · 4.24 KB
/
fig_subway10_map.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
clear all;
figure('pos', [2000 1200 1000 600] * 3/4);
fontsize = 13;
axisfontsize = 10;
lettersize = 14;
ii = 1;
jj = 1;
%load('model_all_data_10samples_MAP_5alpha.mat');
%modelfile = 'model_all_data_20samples_MAP_2alpha.mat'; % preprint
%modelfile = 'model_Exp_1_thru_4_samples=10000_alpha=1.0000_last.mat'; % sample_c
modelfile = 'model_Exp_1_thru_4_samples=10000_alpha=1.0000_eps=0.6000_last.mat';
% A: graph
%
subplot(2,5,1);
load(modelfile);
H = pl(ii).H{jj}(1,1);
D = pl(ii).D{jj}(1,1);
[h, xs, ys] = plot_subway10_graph(H, D);
%labelnode(h, 1:D.G.N, 1:D.G.N);
for i = 1:D.G.N
text(h.XData(i) , h.YData(i) + 0.01, num2str(i), 'FontSize', 10, 'HorizontalAlignment', 'center', 'VerticalAlignment', 'middle');
end
%title([' ','Experimental Design'], 'fontsize', fontsize);
h = subplot(2,5,2);
pos = get(h, 'position');
pos(1) = pos(1) * 0.94;
pos(2) = pos(2) * 0.96;
pos(3) = pos(3) * 1.15;
pos(4) = pos(4) * 1.15;
subplot(2,5, 2, 'position', pos);
PICpng = imread('subway10_map_crop.png');
[rows columns numberOfColorChannels] = size(PICpng);
imshow(PICpng, 'InitialMagnification', 'fit');
title('Experimental Design', 'fontsize', fontsize);
h = subplot(2,5,3);
pos = get(h, 'position');
pos(1) = pos(1) * 0.94;
pos(2) = pos(2) * 0.96;
pos(3) = pos(3) * 1.12;
pos(4) = pos(4) * 1.12;
subplot(2,5, 3, 'position', pos);
PICpng = imread('subway10_trials.png');
[rows columns numberOfColorChannels] = size(PICpng);
imshow(PICpng, 'InitialMagnification', 'fit');
% B: Data
%
subplot(2,5,4);
%load('analyze_all_data.mat'); % preprint
load('analyze_Exp_1_thru_5.mat');
i = ii;
m = pl(i).m ./ pl(i).n;
ci = pl(i).ci ./ pl(i).n;
for j = 1:length(pl(i).m)
se(j) = std([ones(1,pl(i).m(j)) zeros(1,pl(i).n(j) - pl(i).m(j))]) / sqrt(pl(i).n(j));
end
hold on;
j = jj;
h = bar(j, m(j));
errorbar(m(j), se(j), 'linestyle', 'none', 'color', 'black');
%errorbar(m, ci, 'linestyle', 'none', 'color', 'black');
line([0 2], [0.5 0.5], 'linestyle', '--', 'color', [0.6 0.6 0.6]);
%h = fill([0 2 2 0], [0.5 - ci(j) 0.5 - ci(j) 0.5 + ci(j) 0.5 + ci(j)], [0.4 0.4 0.4]);
%set(h, 'facealpha', 0.5, 'edgecolor', 'none');
set(gca, 'xlim', [0 2]);
set(gca, 'ylim', [0 1]);
set(gca, 'ytick', [0 0.5 1]);
set(gca, 'xtick', [1]);
%text(0.7, 0.9, sprintf('p = %.3f', pl(i).p(j)));
%xticklabels({'P(fewer boundaries)'});
%ylabel('fraction of participants');
xticklabels({'fraction participants'});
ylabel('P(action 6 \rightarrow 5)');
hold off;
title('Data', 'fontsize', fontsize);
% C: Model
load(modelfile);
subplot(2,5,5);
i = ii;
m = pl(i).m ./ pl(i).n;
ci = pl(i).ci ./ pl(i).n;
for j = 1:length(pl(i).m)
se(j) = std([ones(1,pl(i).m(j)) zeros(1,pl(i).n(j) - pl(i).m(j))]) / sqrt(pl(i).n(j));
end
hold on;
j = jj;
h = bar(j, m(j));
errorbar(m(j), se(j), 'linestyle', 'none', 'color', 'black');
%errorbar(m, ci, 'linestyle', 'none', 'color', 'black');
line([0 2], [0.5 0.5], 'linestyle', '--', 'color', [0.6 0.6 0.6]);
%h = fill([0 2 2 0], [0.5 - ci(j) 0.5 - ci(j) 0.5 + ci(j) 0.5 + ci(j)], [0.4 0.4 0.4]);
%set(h, 'facealpha', 0.5, 'edgecolor', 'none');
set(gca, 'xlim', [0 2]);
set(gca, 'ylim', [0 1]);
set(gca, 'ytick', [0 0.5 1]);
set(gca, 'xtick', [1]);
%text(0.7, 0.9, sprintf('p = %.3f', pl(i).p(j)));
%xticklabels({'P(fewer boundaries)'});
xticklabels({'fraction simulations'});
hold off;
title('Model', 'fontsize', fontsize);
% D: Hierarchies
%{
for s = 1:12
subplot(4,6, 12 + s);
H = pl(i).H{j}(s);
D = pl(i).D{j}(s);
h = plot_H(H, D);
set(h, 'XData', xs);
set(h, 'YData', ys);
labelnode(h, 1:D.G.N, '');
set(gca, 'xtick', []);
set(gca, 'ytick', []);
set(gca, 'xlim', [-2 4]);
h.MarkerSize = 6;
if s == 3
title([' ', 'Example hierarchies'], 'fontsize', fontsize);
end
end
%}
ax1 = axes('Position',[0 0 1 1],'Visible','off');
axes(ax1);
text(0.10, 0.96, 'A', 'FontSize', lettersize, 'FontWeight', 'bold');
text(0.59, 0.96, 'B', 'FontSize', lettersize, 'FontWeight', 'bold');
text(0.75, 0.96, 'C', 'FontSize', lettersize, 'FontWeight', 'bold');
%text(0.10, 0.52, 'D', 'FontSize', lettersize, 'FontWeight', 'bold');
% save figure
h = gcf;
%set(h, 'PaperPositionMode', 'auto');
set(h, 'PaperOrientation', 'landscape');
print('figures/subway10_map.pdf', '-dpdf');