function [Rs meanR1 meanR2 stdR1 stdR2] = dispsumR(newR, grps)
%% exhibiting samples distribution along the projected or the accumulated
%% PC axis
% Input
%      newR: the data after the rotation and projection 
%      grps: the structure of each class
% Output
%      Rs: the resolution of two classes   
%      meanR1 and meanR2: the mean value of each class
%      stdR1 and stdR2: the standard deviation of each class 

R1 = newR(grps(1).index);
R2 = newR(grps(2).index);
meanR1 = mean(R1);
meanR2 = mean(R2);
stdR1 = std(R1);
stdR2 = std(R2);
Rs = abs(meanR1 - meanR2)/(stdR1 + stdR2);
figure; hold; 
plot(R1, ones(size(R1))-1, 'o'); 
plot(R2, ones(size(R2))-1,'go');
plot([meanR1,meanR1],[-0.1,0.1], 'LineWidth',5);
plot([meanR2,meanR2],[-0.1,0.1], 'Color', 'g', 'LineWidth',5);
axis([0 1 0 2]);
text((meanR1+meanR2)/2-0.09,0.3,['Rs= ',num2str(Rs)]);
ymin = -1; ymax =1;
set(gca, 'YLim', [ymin ymax]);


