123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267 |
- close all;
- clear;
- % boxplots for context effect index
- load('all_ce.mat')
- aw_=all_ce(:,1)==1; n_aw=sum(aw_);
- an_=all_ce(:,1)==2; n_an=sum(an_);
- chi_=all_ce(:,1)==3; n_chi=sum(chi_);
- nav=all_ce(:,2:3);
- com=all_ce(:,4:5);
- % comparisons
- y1=nan(117,2);
- y2=nan(117,2);
- y1(1:n_chi,1:2)=nav(chi_,:);
- y2(1:n_chi,1:2)=com(chi_,:);
- y3=[(y1(:,2)-y1(:,1))./2,(y2(:,2)-y2(:,1))./2] ;
- % to obtain classification per quadrant
- chi_nav=y3(~isnan(y3(:,1)),1);
- chi_com=y3(~isnan(y3(:,2)),2);
- class_chi=nan(n_chi,1);
- % for n=12 uncomment the line below
- % n_chi=12;
- for u=1:n_chi
- if chi_nav(u)>0 && chi_com(u)>0 % first quadrant
- class_chi(u,1)=1;
- elseif chi_nav(u)>0 && chi_com(u)<=0 % second quadrant
- class_chi(u,1)=2;
- elseif chi_nav(u)<=0 && chi_com(u)>0 % forth quadrant
- class_chi(u,1)=4;
- elseif chi_nav(u)<=0 && chi_com(u)<=0 % third quadrant
- class_chi(u,1)=3;
- end
-
- end
- prop_chi=histcounts(class_chi)*100/n_chi;
- % save units # and their respective quadrant classification
- chi=load('chi_data.mat'); chi=chi.all_di;
- pt=load('pt_data.mat'); pt=pt.all_di;
- chi_1=chi(:,3)==0;
- eq_1=chi(:,2)==0;
- chi_2=pt(:,3)==2;
- eq_2=pt(:,2)==0;
- chi_eq=[chi(logical(chi_1.*eq_1),1); pt(logical(chi_2.*eq_2),1)];
- cell_chi=[chi_eq, class_chi];
- save('cell_chi.mat', 'cell_chi')
- % stats
- %for n=12, for n=26 just remove this 3 lines below
- % y1=y1(1:12,:);
- % y2=y2(1:12,:);
- % y3=y3(1:12,:);
- pv1=signrank(y1(:,1),y1(:,2));
- pv2=signrank(y2(:,1),y2(:,2));
- pv3=signrank(y3(:,1),y3(:,2));
- pv4=signrank(y3(:,1));
- pv5=signrank(y3(:,2));
- %% plotting
- red =[0.8500,0.3250, 0.0980];
- blue=[0,0.4470,0.7410];
- red_light=[1,0.5,0.5].*red;
- blue_light=[1,0.5,0.5].*blue;
- green_light=[0.4863,0.3059,0.7098]; % green: [0.3922,0.8314,0.0745];
- green=[0.2980,0.1294,0.5098]; % [0.4667,0.6745,0.1882];
- colors=[green;green_light];
- wid=100;
- hei=150;
- x = 1:2;
- figure(1); set(gcf,'Position',[400 200 wid hei])
- ax = axes();
- hold(ax);
- for i=1:2
- h=boxchart(x(i)*ones(size(y1(:,i))), y1(:,i), 'BoxFaceColor', colors(i,:),'Notch','off');
- h.MarkerStyle='.';
- h.MarkerColor=colors(i,:);
- end
- hold on
- plot(1:2,nanmedian(y1(:,1:2)),'-o','LineWidth',1,'Color',green,'MarkerSize',3,'MarkerFaceColor',green)
- hold off
- xlim([0.5 2.5])
- ylabel('fast echo effect')
- xticklabels({'match','mismatch'});
- set(gca, 'box', 'off')
- set(gca, 'Color','none')
- set(gca,'linewidth',1);set(gca,'fontsize',8);
- % plot lines for comparison
- line1=0.45;
- sl=0.75;
- hold on
- plot([1 2], [1 1]*line1, '-k','LineWidth',sl)
- plot([1;1]*1,[line1,line1-0.05],'-k', 'LineWidth',sl);
- plot([1;1]*2,[line1,line1-0.05],'-k', 'LineWidth',sl);
- ylim([-1.1 0.75])
- % plot level of significance
- if pv1 <= 0.05 && pv1 > 0.01
- text(mean(1:2)-0.025, line1+0.05, '*')
- elseif pv1 <=0.01 && pv1 > 0.001
- text(mean(1:2)-0.05, line1+0.05, '**')
- elseif pv1 <= 0.001
- text(mean(1:2)-0.15, line1+0.05, '***')
- else
- text(mean(1:2)-0.05, line1+0.1, 'ns','FontSize',8)
- end
- % exportgraphics(gcf,'E:\Users\User\Desktop\delay paper\anesthetized\figures_paper\chi_nav.pdf',...
- % 'Resolution',300','ContentType','vector','BackgroundColor','none')
- figure(2); set(gcf,'Position',[500 200 wid hei])
- ax = axes();
- hold(ax);
- for i=1:2
- h=boxchart(x(i)*ones(size(y2(:,i))), y2(:,i), 'BoxFaceColor', colors(i,:),'Notch','off');
- h.MarkerStyle='.';
- h.MarkerColor=colors(i,:);
- end
- hold on
- plot(1:2,nanmedian(y2(:,1:2)),'-o','LineWidth',1,'Color',green,'MarkerSize',3,'MarkerFaceColor',green)
- hold off
- xlim([0.5 2.5])
- ylabel('slow com effect')
- xticklabels({'match','mismatch'});
- set(gca, 'box', 'off')
- set(gca, 'Color','none')
- set(gca,'linewidth',1);set(gca,'fontsize',8);
- % plot lines for comparison
- line1=0.45; % 0.0 for n=12 %0.45 for n=26
- sl=0.75;
- hold on
- plot([1 2], [1 1]*line1, '-k','LineWidth',sl)
- plot([1;1]*1,[line1,line1-0.05],'-k', 'LineWidth',sl);
- plot([1;1]*2,[line1,line1-0.05],'-k', 'LineWidth',sl);
- ylim([-1.1 0.75]) % for n=26
- % ylim([-1.1 0.2]) % for n=12
- % plot level of significance
- if pv2 <= 0.05 && pv2 > 0.01
- text(mean(1:2)-0.025, line1+0.05, '*')
- elseif pv2 <=0.01 && pv2 > 0.001
- text(mean(1:2)-0.05, line1+0.05, '**')
- elseif pv2 <= 0.001
- text(mean(1:2)-0.15, line1+0.05, '***')
- else
- text(mean(1:2)-0.05, line1+0.1, 'ns','FontSize',8)
- end
- % exportgraphics(gcf,'E:\Users\User\Desktop\delay paper\anesthetized\figures_paper\chi_com.pdf',...
- % 'Resolution',300','ContentType','vector','BackgroundColor','none')
- figure(3); set(gcf,'Position',[600 200 wid hei])
- ax = axes();
- hold(ax);
- for i=1:2
- h=boxchart(x(i)*ones(size(y3(:,i))), y3(:,i), 'BoxFaceColor', colors(i,:),'Notch','off');
- h.MarkerStyle='.';
- h.MarkerColor=colors(i,:);
- end
- hold on
- plot(1:2,nanmedian(y3(:,1:2)),'-o','LineWidth',1,'Color',green,'MarkerSize',3,'MarkerFaceColor',green)
- hold off
- xlim([0.5 2.5])
- ylabel('s.s.s.')
- xticklabels({'fast echo','slow com'});
- set(gca, 'box', 'off')
- set(gca, 'Color','none')
- set(gca,'linewidth',1);set(gca,'fontsize',8);
- % plot lines for comparison
- xt = get(gca, 'XTick');
- line1=0.35;
- hold on
- plot(xt(1:2), [1 1]*line1, '-k','LineWidth',sl)
- plot([1;1]*xt(1),[line1,line1-0.03],'-k', 'LineWidth',sl);
- plot([1;1]*xt(2),[line1,line1-0.03],'-k', 'LineWidth',sl);
- ylim([-0.35 0.4])
- % plot level of significance
- if pv3 <= 0.05 && pv3 > 0.01
- text(mean(xt(1:2))-0.025, line1+0.02, '*','HorizontalAlignment','center')
- elseif pv3 <=0.01 && pv3 > 0.001
- text(mean(xt(1:2))-0.05, line1+0.02, '**','HorizontalAlignment','center')
- elseif pv3 <= 0.001
- text(mean(xt(1:2))-0.15, line1+0.02, '***','HorizontalAlignment','center')
- else
- text(mean(xt(1:2))-0.05, line1+0.1, 'ns','FontSize',7,'HorizontalAlignment','center')
- end
- % add stats against null distribution
- line0=-0.3;
- if pv4 <= 0.05 && pv4 > 0.01
- text(xt(1), line0, '*','HorizontalAlignment','center')
- elseif pv4 <=0.01 && pv4 > 0.001
- text(xt(1), line0, '**','HorizontalAlignment','center')
- elseif pv4 <= 0.001
- text(xt(1), line0, '***','HorizontalAlignment','center')
- else
- text(xt(1), line0+0.01, 'ns','FontSize',7,'HorizontalAlignment','center')
- end
- if pv5 <= 0.05 && pv5 > 0.01
- text(xt(2), line0, '*','HorizontalAlignment','center')
- elseif pv5 <=0.01 && pv5 > 0.001
- text(xt(2), line0, '**','HorizontalAlignment','center')
- elseif pv5 <= 0.001
- text(xt(2), line0, '***','HorizontalAlignment','center')
- else
- text(xt(2), line0+0.01, 'ns','FontSize',8,'HorizontalAlignment','center')
- end
- % l=yline(0,'Color',[0.6 0.6 0.6], 'LineWidth',2);
- % uistack(l,'bottom')
- % exportgraphics(gcf,'E:\Users\User\Desktop\delay paper\anesthetized\figures_paper\dd_chi.pdf',...
- % 'Resolution',300','ContentType','vector','BackgroundColor','none')
- figure(4); set(gcf,'Position',[200 200 100 100])
- b=bar(prop_chi);
- b.EdgeColor=green_light;
- b.FaceColor=green_light;
- b.LineWidth =1.0;
- b.FaceAlpha = 0.2;
- b.BarWidth=0.75;
- xlim([0.25 4.75])
- ylabel('% units')
- xticklabels({'I','II','III','IV'});
- set(gca, 'box', 'off')
- set(gca, 'Color','none')
- set(gca,'linewidth',1);set(gca,'fontsize',8);
- % exportgraphics(gcf,'E:\Users\User\Desktop\delay paper\anesthetized\figures_paper\class_quad_chi.pdf',...
- % 'Resolution',300','ContentType','vector','BackgroundColor','none')
|