figure()
hold on
xi=HF_Xcorr_ind_vs_TremorFreq_Compilation.ind_TremorFreq_T;
yi=HF_Xcorr_ind_vs_TremorFreq_Compilation.Xcorr_ind_maxfreq_T;
xc=cell2mat(HF_XcorrCombined_vs_TremorFreq_Compilation.TremorFreqMax_T);
yc=HF_XcorrCombined_vs_TremorFreq_Compilation.Xcorr_combined_maxfreq_T;
scatter(xi,yi,40,'MarkerEdgeColor',[0.3010 0.7450 0.9330])
scatter(xc,yc,60,'filled','MarkerEdgeColor',[0 0.4470 0.7410],'MarkerFaceColor',[0 0.4470 0.7410])
scatter(cmi(1),cmi(2),60,[0.3010 0.7450 0.9330],'x')
scatter(cmc(1),cmc(2),60,[0 0.4470 0.7410],'x')
line([0 50],[0 50],'Color','black','LineStyle','--','LineWidth',1.2)
legend('','','','','','Location','east')
xlim([0 50])
ylim([0 50])
xlabel('Tremor Peak Frequency (hz)','FontSize',14)
ylabel('Modulation Peak Frequency (hz)','FontSize',14)
hold off
saveas(gcf,'Xcorr_IndvsComb(withCM)(rm).fig')

%% caculate how close each dots are from the center of mass
cmi=[mean(xi),mean(yi)];
cmc=[mean(xc),mean(yc)];

diff_cmix=xi-cmi(1);
diff_cmiy=yi-cmi(2);
diff_cmcx=xc-cmc(1);
diff_cmcy=yc-cmc(2);
dist_cmi=sqrt(diff_cmix.^2+diff_cmiy.^2);
dist_cmc=sqrt(diff_cmcx.^2+diff_cmcy.^2);

figure()
hold on
scatter(ones(181,1),dist_cmi)
scatter(ones(24,1)+0.5,dist_cmc)
xlim([0 2])