Repository navigation
Expand file tree
/
Copy pathStep6_barplot.m
More file actions
78 lines (62 loc) · 3.71 KB
/
Copy pathStep6_barplot.m
File metadata and controls
78 lines (62 loc) · 3.71 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
%calculate mean of controls and patient data for loading parameters
%using a barplot but also HC > SZ, and SZ > HC spatial maps
cd '/Users/amrithah/Desktop/CalhounLab/Dissertation/Projects/Chapter6_Paper_5_SPECT Template/Scripts/sc-ICA'
a = spect_ICA_loading_params; %rename variable for simpler calculation with means
hcind = 1:76;
sczind = 77:213;
hcmn = mean(a(hcind,:));
szmn = mean(a(sczind,:));
%% plot the significant components in a bar plot for the new neuromark spect loading parameters
cd '/Users/amrithah/Desktop/CalhounLab/Dissertation/Projects/Chapter6_Paper_5_SPECT Template/Scripts/sc-ICA'
% Data for the bars
data = hcmn - szmn; %mean difference, with significant ones stars
% Define positions for each bar for clarity in plotting
positions = 1:length(data);
% Define the positions where stars will be added for significant results:
% total 23 significant components
star_positions_qval_onestar = [9, 11,14,16,54]; %q<0.05, 5 components
star_positions_qval_twostar = [2,3,15,17,19,22,23,24,25,32,33,34,46,53,56,59,60,68]; %q<0.01, 18 components
% Plot the bars individually to set specific colors, and specify unique
% hexdec codes for creating own colors
%plot all NeuroMark 2.2 domains and subdomains
hold on; % Allows multiple bars to be plotted on the same figure
bar1 = bar(positions(1:10), data(1:10), 'FaceColor', 'red'); % cerebellar
bar2 = bar(positions(11:15), data(11:15), 'FaceColor', 'green'); % HC-FR
bar3 = bar(positions(16:18), data(16:18), 'FaceColor', 'blue'); % HC-IT
bar4 = bar(positions(19:26), data(19:26), 'FaceColor', 'cyan'); % HC-TP
bar5 = bar(positions(27:28), data(27:28), 'FaceColor', 'magenta'); % SC-BG
bar6 = bar(positions(29:33), data(29:33), 'FaceColor', 'yellow'); % SC-EH
bar7 = bar(positions(34), data(34), 'FaceColor', [0.8 0.4 1]); % SC-ET
bar8 = bar(positions(35:43), data(35:43), 'FaceColor', [0.3 0.6 0.9]); % sensorimotor
bar9 = bar(positions(44:45), data(44:45), 'FaceColor', [0.5 0 0.5]); % TN-CE (purple)
bar10 = bar(positions(46:54), data(46:54), 'FaceColor', [1 0.5 0]); % TN-DM (orange)
bar11 = bar(positions(55), data(55), 'FaceColor', [0 0.8 0.7]); % TN-SA (teal)
bar12 = bar(positions(56:67), data(56:67), 'FaceColor', [0 0.2 0.6]); % VI-OC
bar13 = bar(positions(68), data(68), 'FaceColor', [0 0.5 0.5]); % VI-OT
% Add single stars (*) above specified bars
for i = 1:length(star_positions_qval_onestar)
pos = star_positions_qval_onestar(i); % Current bar position
text(pos, data(pos) + 0.01, '*', 'HorizontalAlignment', 'center', 'FontSize', 14, 'Color', 'k');
end
% Add double stars (**) above specified bars
for i = 1:length(star_positions_qval_twostar)
pos = star_positions_qval_twostar(i); % Current bar position
text(pos, data(pos) + 0.01, '**', 'HorizontalAlignment', 'center', 'FontSize', 14, 'Color', 'k');
end
% Add title, labels, and legend
title('Healthy - Patient Mean Loading Parameters Plotted along with Group Difference t-test FDR corrected results (q < 0.05)')
xlabel('NeuroMark SPECT Template Component #s (Components 1-68)')
ylabel('Loading Parameter Values')
L1 = {'cerebellar', 'HC-FR', 'HC-IT','HC-TP', 'SC-BG', 'SC-EH', 'SC-ET', 'sensorimotor', 'TN-CE', 'TN-DM', 'TN-SA', 'VI-OC', 'VI-OT'}; % Define legend with the NM 2.2 Domains and Subdomains
lgd1 = legend(L1, 'Location', 'northwest');
% Set x-axis tick labels
x = 1:68; % Label components for the tickmarks
xticks(x); % Set the tickmarks
hold on;
ax = gca;
ax.FontSize = 13;
%save file
%make sure to stretch image out before saving! else text gets all jumbled
%up
savefig('Significant_Components_FDR_Corrected_Bar_Plot.fig');
movefile('*.fig', '/Users/amrithah/Desktop/CalhounLab/Dissertation/Projects/Chapter6_Paper_5_SPECT Template/Figures');