%Use vline file to draw vertical lines
%https://www.mathworks.com/matlabcentral/fileexchange/1039-hline-and-vline

%Enter directory
load("DIRECTORY\input.mat");
a1=0.14;
b1=-0.06;
a2=0.10;
b2=-0.12;
a3=0.13;
b3=-0.08;
a4=0.11;
b4=-0.11;

figure
subplot(4,1,1)  
histfit(loading(:,1),20)
hold on
vline(0.14,'g')
hold on
vline(-0.06,'g')
xlim([-.4 .4])
ylim([0 15])
title('PC1')

subplot(4,1,2) 
histfit(loading(:,2),20)
vline(0.10,'g')
hold on
vline(-0.12,'g')
xlim([-.4 .4])
ylim([0 15])
title('PC2')

subplot(4,1,3) 
histfit(loading(:,3),20)
vline(0.13,'g')
hold on
vline(-0.08,'g')
xlim([-.4 .4])
ylim([0 15])
title('PC3')

subplot(4,1,4) 
histfit(loading(:,4),20)
vline(0.11,'g')
hold on
vline(-0.11,'g')
xlim([-.4 .4])
ylim([0 15])
title('PC4')