-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_spls.m
More file actions
80 lines (59 loc) · 2.53 KB
/
Copy pathplot_spls.m
File metadata and controls
80 lines (59 loc) · 2.53 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
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
function plot_spls(level,res,varargin)
if (~isempty(varargin))
boolABCD=varargin{1};
else
boolABCD=0;
end
clc; close all
corrVal = 0.25;
% Set path with plotting folder and necessary toolboxes
set_path('plot', 'brainnet', 'spm');
%----- Initialize res and update path to experiment
res.frwork.level = level;
res.env.fileend = '_1';
% Optional fields
res.gen.selectfile = 'none';
% Update path if data moved (e.g. from cluster to local computer)
update_dir(res.dir.frwork, res.env.fileend)
% Initialize res
res = res_defaults(res, 'load');
% %----- Plot results
% % % % Plot hyperparameter surface for grid search results
for i=1:res.frwork.split.nall
plot_paropt(res, {'X' 'Y'}, res.frwork.split.all(i), 'correl', 'simwx', 'simwy');
end
% % % % Plot data projections by group (healthy, depressed)
for i=1:res.frwork.split.nall
display('Plotting projections')
plot_proj_tr_test(res, {'X' 'Y'}, res.frwork.level, 'osplit', res.frwork.split.all(i),'none','2d');
end
% % % % Plot behavioural weights as horizontal bar plot
for i=1:res.frwork.split.nall
res.behav.weight.numtop=40;
plot_weight(res, 'Y', 'behav', res.frwork.split.all(i), 'behav_horz');
%%%PLOTTING THE LOADINGS
plot_corr(res, 'Y', 'behav', res.frwork.split.all(i), 'corr_behav', corrVal);
xlabel('Loadings', 'FontSize', 16)
saveas(gcf, [res.dir.res filesep 'behav_corr.png']);
end
% % % Plot cortical brain weights
for i=1:numel(res.frwork.split.all)
if boolABCD == 1
plot_weight(res, 'X', 'vbm', res.frwork.split.all(i), 'brain_cortex', ...
'vbm.transM', [0.99 0 0 0; 0 1 0 0; 0 0 1 0; 0 0 0 1], ...
'vbm.file.MNI', fullfile(res.dir.project, 'data', 'subject.nii'));
%PLOTTING THE LOADINGS
plot_corr(res, 'X', 'vbm', res.frwork.split.all(i), 'brain_cortex', corrVal, ...
'vbm.transM', [0.99 0 0 0; 0 1 0 0; 0 0 1 0; 0 0 0 1], ...
'vbm.file.MNI', fullfile(res.dir.project, 'data', 'subject.nii'));
else if boolABCD == 0
plot_weight(res, 'X', 'vbm', res.frwork.split.all(i), 'brain_cortex', ...
'vbm.file.mask', fullfile(res.dir.project, 'data', 'mask.nii'));
else if boolABCD ==2
plot_weight(res, 'X', 'vbm', res.frwork.split.all(i), 'brain_cortex', ...
'vbm.transM', [1 0 0 118.6; 0 1 0 -128.6; 0 0 1 -63.3; 0 0 0 1], ...
'vbm.file.MNI', fullfile(res.dir.project, 'data', 'mask.nii'));
end
end
end
end