-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlotPCs.m
25 lines (19 loc) · 953 Bytes
/
PlotPCs.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
% PlotPCs.m
% Sarah West
% 5/23/22
% Plot a number of principal components. Run by RunAnalysis.
function [parameters] = PlotPCs(parameters)
[subplot_rows, subplot_columns] = OptimizeSubplotNumbers(numel(parameters.components_to_plot),4/5);
indices = logical(tril(ones(parameters.number_of_sources), -1));
fig = figure;
fig.WindowState = 'maximized';
for componenti = 1:numel(parameters.components_to_plot)
holder = NaN(parameters.number_of_sources, parameters.number_of_sources);
holder(indices) = parameters.components(:, parameters.components_to_plot(componenti));
subplot(subplot_rows, subplot_columns, componenti); imagesc(holder); caxis(parameters.color_range)
title(['PC ' num2str(parameters.components_to_plot(componenti))]); axis square;
end
sgtitle(strjoin(parameters.values(1:numel(parameters.values)/2), ', '))
% Put into output structure.
parameters.fig = fig;
end