forked from alighavam/EFC1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
efc1_paper.m
229 lines (198 loc) · 11 KB
/
efc1_paper.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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
function varargout=efc1_paper(what, varargin)
addpath('functions/')
% setting paths:
usr_path = userpath;
usr_path = usr_path(1:end-17);
project_path = fullfile(usr_path, 'Desktop', 'Projects', 'EFC1');
% colors:
colors_red = [[255, 219, 219] ; [255, 146, 146] ; [255, 73, 73] ; [255, 0, 0] ; [182, 0, 0]]/255;
colors_gray = ['#d3d3d3' ; '#b9b9b9' ; '#868686' ; '#6d6d6d' ; '#535353'];
colors_blue = ['#dbecff' ; '#a8d1ff' ; '#429bff' ; '#0f80ff' ; '#0067db'];
colors_green = ['#9bdbb1' ; '#3aa35f' ; '#3aa35f' ; '#2d7d49' ; '#1f5833'];
colors_cyan = ['#adecee' ; '#83e2e5' ; '#2ecfd4' ; '#23a8ac' ; '#1b7e81'];
colors_random = ['#773344' ; '#E3B5A4' ; '#83A0A0' ; '#0B0014' ; '#D44D5C'];
colors_pastel = ['#FFA500' ; '#1E90FF'];
colors_blue = hex2rgb(colors_blue);
colors_green = hex2rgb(colors_green);
colors_cyan = hex2rgb(colors_cyan);
colors_gray = hex2rgb(colors_gray);
colors_random = hex2rgb(colors_random);
colors_pastel = hex2rgb(colors_pastel);
colors_measures = [colors_red(3,:) ; colors_cyan(3,:) ; colors_blue(5,:)];
% figure properties:
my_font.label = 10;
my_font.title = 11;
my_font.tick_label = 8;
my_font.legend = 8;
% paper fig sizes:
paper.err_width = 0.7;
paper.line_width = 2;
paper.lineplot_line_width = 2;
paper.marker_size = 35;
paper.lineplot_marker_size = 3.5;
paper.horz_line_width = 2;
paper.axis_width = 1;
paper.bar_line_width = 1.5;
paper.bar_width = 1;
switch (what)
case 'success_rate'
C = dload(fullfile(project_path,'analysis','success_rate.tsv'));
varargout{1} = C;
fig = figure('Units','centimeters', 'Position',[15 15 5 6]);
fontsize(fig, my_font.tick_label, 'points')
drawline(1,'dir','horz','color',[0.8 0.8 0.8],'lim',[0 5],'linewidth',paper.horz_line_width,'linestyle',':'); hold on;
errorbar(C.sess,C.difficult,C.difficult_sem,'LineStyle','none','CapSize',0,'Color',colors_gray(5,:),'LineWidth',paper.err_width);
plot(C.sess,C.difficult,'Color',colors_gray(5,:),'LineWidth',paper.line_width)
scatter(C.sess,C.difficult,paper.marker_size,'MarkerFaceColor',colors_gray(5,:),'MarkerEdgeColor',colors_gray(5,:));
errorbar(C.sess,C.all_chords,C.all_chords_sem,'LineStyle','none','CapSize',0,'Color',colors_gray(2,:),'LineWidth',paper.err_width);
plot(C.sess,C.all_chords,'Color',[colors_gray(2,:), 0.6],'LineWidth',paper.line_width)
lgd = legend({'','',['Most Challenging' newline 'Chord per Subject'],'','','All 242 Chords'});
legend boxoff
fontsize(lgd,my_font.legend,'points')
ylim([0,1])
xlim([0.8,4.2])
h = gca;
h.YAxis.TickValues = 0:0.5:1;
h.XAxis.TickValues = 1:4;
h.XAxis.FontSize = my_font.tick_label;
h.YAxis.FontSize = my_font.tick_label;
h.LineWidth = paper.axis_width;
xlabel('days','FontSize',my_font.label)
ylabel('success rate','FontSize',my_font.label)
box off
set(gca, 'FontName', 'arial');
case 'training_performance'
C = dload(fullfile(project_path,'analysis','training_performance.tsv'));
% ======== MD ========
fig_MD = figure('Units','centimeters', 'Position',[15 15 4.2 6]);
% single-finger chords as baseline:
lineplot(C.sess(C.finger_count==1),C.MD(C.finger_count==1),'markertype','o','markersize',paper.lineplot_marker_size,'markerfill',colors_gray(2,:),'markercolor',colors_gray(2,:),'linecolor',colors_gray(2,:),'linewidth',paper.lineplot_line_width,'errorcolor',colors_gray(2,:),'errorcap',0); hold on;
% multi-finger chords:
[~, X, Y, COND] = get_sem(C.MD(C.finger_count>1), C.sn(C.finger_count>1), C.sess(C.finger_count>1), ones(sum(C.finger_count>1),1));
lineplot(X,Y,'markertype','o','markersize',paper.lineplot_marker_size,'markerfill',colors_blue(5,:),'markercolor',colors_blue(5,:),'linecolor',colors_blue(5,:),'linewidth',paper.lineplot_line_width,'errorcolor',colors_blue(5,:),'errorcap',0);
h = gca;
ylim([0.5 2])
h.YTick = [0.5 1.3 2];
xlim([0.5 4.5])
h.XAxis.FontSize = my_font.tick_label;
h.YAxis.FontSize = my_font.tick_label;
xlabel('days','FontSize',my_font.label)
ylabel('MD','FontSize',my_font.label)
h.LineWidth = paper.axis_width;
fontname("arial")
% ======== RT ========
fig_RT = figure('Units','centimeters', 'Position',[15 15 4.2 6]);
% single-finger chords as baseline:
lineplot(C.sess(C.finger_count==1),C.RT(C.finger_count==1),'markertype','o','markersize',paper.lineplot_marker_size,'markerfill',colors_gray(2,:),'markercolor',colors_gray(2,:),'linecolor',colors_gray(2,:),'linewidth',paper.lineplot_line_width,'errorcolor',colors_gray(2,:),'errorcap',0); hold on;
% multi-finger chords:
[~, X, Y, COND] = get_sem(C.RT(C.finger_count>1), C.sn(C.finger_count>1), C.sess(C.finger_count>1), ones(sum(C.finger_count>1),1));
lineplot(X,Y,'markertype','o','markersize',paper.lineplot_marker_size,'markerfill',colors_blue(5,:),'markercolor',colors_blue(5,:),'linecolor',colors_blue(5,:),'linewidth',paper.lineplot_line_width,'errorcolor',colors_blue(5,:),'errorcap',0);
h = gca;
ylim([170, 400])
h.YTick = [170 280 400];
xlim([0.5 4.5])
h.XAxis.FontSize = my_font.tick_label;
h.YAxis.FontSize = my_font.tick_label;
xlabel('days','FontSize',my_font.label)
ylabel('RT','FontSize',my_font.label)
h.LineWidth = paper.axis_width;
fontname("arial")
case 'training_finger_count_effect'
C = dload(fullfile(project_path,'analysis','training_performance.tsv'));
% ======== MD ========
fig_MD = figure('Units','centimeters', 'Position',[15 15 4.5 6]);
[~, X, Y, COND] = get_sem(C.MD, C.sn, ones(size(C.sn)), C.finger_count);
lineplot(COND,Y,'markertype','o','markersize',paper.lineplot_marker_size,'markerfill',colors_pastel(1,:),'markercolor',colors_pastel(1,:),'linecolor',colors_pastel(1,:),'linewidth',paper.lineplot_line_width,'errorcolor',colors_pastel(1,:),'errorcap',0);
h = gca;
ylim([0 2.4])
h.YTick = [0 1.2 2.4];
xlim([0.5 5.5])
h.XAxis.FontSize = my_font.tick_label;
h.YAxis.FontSize = my_font.tick_label;
xlabel('Finger Count','FontSize',my_font.label)
ylabel('MD','FontSize',my_font.label)
h.LineWidth = paper.axis_width;
fontname("arial")
% ======== RT ========
fig_RT = figure('Units','centimeters', 'Position',[15 15 4.5 6]);
[~, X, Y, COND] = get_sem(C.RT, C.sn, ones(size(C.sn)), C.finger_count);
lineplot(COND,Y,'markertype','o','markersize',paper.lineplot_marker_size,'markerfill',colors_pastel(2,:),'markercolor',colors_pastel(2,:),'linecolor',colors_pastel(2,:),'linewidth',paper.lineplot_line_width,'errorcolor',colors_pastel(2,:),'errorcap',0);
h = gca;
ylim([200 500])
h.YTick = [200 350 500];
xlim([0.5 5.5])
h.XAxis.FontSize = my_font.tick_label;
h.YAxis.FontSize = my_font.tick_label;
xlabel('Finger Count','FontSize',my_font.label)
ylabel('RT','FontSize',my_font.label)
h.LineWidth = paper.axis_width;
fontname("arial")
case 'training_repetition_effect'
C = dload(fullfile(project_path,'analysis','training_repetition.tsv'));
% ====== MD ======:
fig_MD = figure('Units','centimeters', 'Position',[15 15 6 6]);
% average data over finger count:
[~, X1, Y1, COND] = get_sem(C.MD_subj_rep1, C.sn, C.sess, ones(size(C.sn)));
[~, X2, Y2, COND] = get_sem(C.MD_subj_rep2, C.sn, C.sess, ones(size(C.sn)));
[~, X3, Y3, COND] = get_sem(C.MD_subj_rep3, C.sn, C.sess, ones(size(C.sn)));
[~, X4, Y4, COND] = get_sem(C.MD_subj_rep4, C.sn, C.sess, ones(size(C.sn)));
[~, X5, Y5, COND] = get_sem(C.MD_subj_rep5, C.sn, C.sess, ones(size(C.sn)));
offset_size = 5;
x_offset = 0:offset_size:5*(length(unique(C.sess))-1);
hold on;
for j = 1:length(unique(C.sess))
x_tmp = [ones(sum(X1==j),1);2*ones(sum(X2==j),1);3*ones(sum(X3==j),1);4*ones(sum(X4==j),1);5*ones(sum(X5==j),1)];
y_tmp = [Y1(X1==j);Y2(X2==j);Y3(X3==j);Y4(X4==j);Y5(X5==j)];
lineplot(x_tmp+x_offset(j),y_tmp,'markertype','o','markersize',paper.lineplot_marker_size-1,'markerfill',colors_blue(5,:),'markercolor',colors_blue(5,:),'linecolor',colors_blue(5,:),'linewidth',paper.lineplot_line_width-0.7,'errorcolor',colors_blue(5,:),'errorwidth',paper.err_width,'errorcap',0);
end
box off
h = gca;
h.XTick = 5*(1:length(unique(C.sess))) - 2;
h.XTickLabel = {'1','2','3','4'};
h.XAxis.FontSize = my_font.tick_label;
h.YAxis.FontSize = my_font.tick_label;
h.LineWidth = paper.axis_width;
h.YTick = [0.5,1.7,2.8];
ylim([0.5 2.8])
xlim([0,21])
xlabel('days','FontSize',my_font.label)
ylabel('MD','FontSize',my_font.label)
fontname("Arial")
% stats:
fprintf('\n======== MD Change in rep1 from day 1 to 4 ========\n')
T_MD_rep1Imprv = MANOVArp(C.sn,C.sess,C.MD_subj_rep1);
% ====== RT ======:
fig_RT = figure('Units','centimeters', 'Position',[15 15 6 6]);
% average data over finger count:
[~, X1, Y1, COND] = get_sem(C.RT_subj_rep1, C.sn, C.sess, ones(size(C.sn)));
[~, X2, Y2, COND] = get_sem(C.RT_subj_rep2, C.sn, C.sess, ones(size(C.sn)));
[~, X3, Y3, COND] = get_sem(C.RT_subj_rep3, C.sn, C.sess, ones(size(C.sn)));
[~, X4, Y4, COND] = get_sem(C.RT_subj_rep4, C.sn, C.sess, ones(size(C.sn)));
[~, X5, Y5, COND] = get_sem(C.RT_subj_rep5, C.sn, C.sess, ones(size(C.sn)));
offset_size = 5;
x_offset = 0:offset_size:5*(length(unique(C.sess))-1);
hold on;
for j = 1:length(unique(C.sess))
x_tmp = [ones(sum(X1==j),1);2*ones(sum(X2==j),1);3*ones(sum(X3==j),1);4*ones(sum(X4==j),1);5*ones(sum(X5==j),1)];
y_tmp = [Y1(X1==j);Y2(X2==j);Y3(X3==j);Y4(X4==j);Y5(X5==j)];
lineplot(x_tmp+x_offset(j),y_tmp,'markertype','o','markersize',paper.lineplot_marker_size-1,'markerfill',colors_blue(5,:),'markercolor',colors_blue(5,:),'linecolor',colors_blue(5,:),'linewidth',paper.lineplot_line_width-0.7,'errorcolor',colors_blue(5,:),'errorwidth',paper.err_width,'errorcap',0);
end
box off
h = gca;
h.XTick = 5*(1:length(unique(C.sess))) - 2;
h.XTickLabel = {'1','2','3','4'};
h.XAxis.FontSize = my_font.tick_label;
h.YAxis.FontSize = my_font.tick_label;
h.LineWidth = paper.axis_width;
h.YTick = [150,350,550];
ylim([150 550])
xlim([0,21])
ylabel('RT','FontSize',my_font.label)
xlabel('days','FontSize',my_font.label)
fontname("Arial")
% stats:
fprintf('\n======== RT Change in rep1 from day 1 to 4 ========\n')
T = MANOVArp(C.sn,C.sess,C.RT_subj_rep1);
otherwise
error('The analysis %s you entered does not exist!',what)
end