function disprotpcsallpoints(newR, grps, d1, d2)
%% exhibiting samples distribution in PC plot
% Input
%      newR: the scores of the training set after PCA
%      grps£şthe structure of each class
%      d1,d2: the index of PCs

grpnumber = size(grps,2);
R1 = newR(:,d1);
R2 = newR(:,d2);

for i = 1:grpnumber
    RR1(i) = mean(R1(grps(i).index));
    RR2(i) = mean(R2(grps(i).index));
end

figure; hold; 
if grpnumber == 2,
    plot(R1(grps(1).index), R2(grps(1).index), 'o');
    plot(R1(grps(2).index), R2(grps(2).index), 'go');
else
    for i = 1:grpnumber; plot(R1(grps(i).index), R2(grps(i).index), 'o'); end
end
plot(RR1,RR2,'ro');
sh = 0.02*(max(RR1)-min(RR1));
for i=1:length(RR1),
    text(RR1(i)+sh,RR2(i),grps(i).class); 
end

