Fig6C-Fig7A-B.m 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. close all;
  2. clear;
  3. % boxplots for context effect index
  4. load('all_ce.mat')
  5. aw_=all_ce(:,1)==1; n_aw=sum(aw_);
  6. an_=all_ce(:,1)==2; n_an=sum(an_);
  7. chi_=all_ce(:,1)==3; n_chi=sum(chi_);
  8. nav=all_ce(:,2:3);
  9. com=all_ce(:,4:5);
  10. % comparisons
  11. y1=nan(117,4);
  12. y2=nan(117,4);
  13. y1(1:n_aw,1:2)=nav(aw_,:);
  14. y1(1:n_an,3:4)=nav(an_,:);
  15. y2(1:n_aw,1:2)=com(aw_,:);
  16. y2(1:n_an,3:4)=com(an_,:);
  17. y3=[(y1(:,2)-y1(:,1))./2,(y2(:,2)-y2(:,1))./2,(y1(:,4)-y1(:,3))./2,(y2(:,4)-y2(:,3))./2] ;
  18. %% plotting
  19. red =[0.8500,0.3250, 0.0980];
  20. blue=[0,0.4470,0.7410];
  21. red_light=[1,0.5,0.5].*red;
  22. blue_light=[1,0.5,0.5].*blue;
  23. colors=[blue;blue_light;red;red_light];
  24. wid=160;
  25. hei=180;
  26. x = 1:4;
  27. figure(1); set(gcf,'Position',[400 200 wid hei])
  28. ax = axes();
  29. hold(ax);
  30. for i=1:4
  31. h=boxchart(x(i)*ones(size(y1(:,i))), y1(:,i), 'BoxFaceColor', colors(i,:),'Notch','on');
  32. h.MarkerStyle='.';
  33. h.MarkerColor=colors(i,:);
  34. end
  35. hold on
  36. plot(1:2,nanmedian(y1(:,1:2)),'-o','LineWidth',1,'Color',blue,'MarkerSize',3,'MarkerFaceColor',blue)
  37. plot(3:4,nanmedian(y1(:,3:4)),'-o','LineWidth',1,'Color',red,'MarkerSize',3,'MarkerFaceColor',red)
  38. hold off
  39. xlim([0.5 4.5])
  40. ylabel('echolocation effect')
  41. xticklabels({'match','mismatch','match','mismatch'});
  42. set(gca, 'box', 'off')
  43. set(gca, 'Color','none')
  44. set(gca,'linewidth',1);set(gca,'fontsize',8);
  45. %% add stats
  46. pv1=signrank(y1(:,1),y1(:,2));
  47. pv2=signrank(y1(:,3),y1(:,4));
  48. pv3=ranksum(y1(:,1),y1(:,3));
  49. pv4=ranksum(y1(:,2),y1(:,4));
  50. xt = get(gca, 'XTick');
  51. line1=0.45;
  52. line2=0.65;
  53. line3=0.85;
  54. sl=0.75;
  55. % plot lines for comparison
  56. hold on
  57. plot(xt(1:2), [1 1]*line1, '-k','LineWidth',sl)
  58. plot([1;1]*xt(1),[line1,line1-0.05],'-k', 'LineWidth',sl);
  59. plot([1;1]*xt(2),[line1,line1-0.05],'-k', 'LineWidth',sl);
  60. plot(xt(3:4), [1 1]*line1, '-k','LineWidth',sl)
  61. plot([1;1]*xt(3),[line1,line1-0.05],'-k', 'LineWidth',sl);
  62. plot([1;1]*xt(4),[line1,line1-0.05],'-k', 'LineWidth',sl);
  63. plot([xt(1) xt(3)], [1 1]*line2, '-k','LineWidth',sl)
  64. plot([1;1]*xt(1),[line2,line2-0.05],'-k', 'LineWidth',sl);
  65. plot([1;1]*xt(3),[line2,line2-0.05],'-k', 'LineWidth',sl);
  66. plot([xt(2) xt(4)], [1 1]*line3, '-k','LineWidth',sl)
  67. plot([1;1]*xt(2),[line3,line3-0.05],'-k', 'LineWidth',sl);
  68. plot([1;1]*xt(4),[line3,line3-0.05],'-k', 'LineWidth',sl);
  69. ylim([-1 1])
  70. % plot level of significance
  71. if pv1 <= 0.05 && pv1 > 0.01
  72. text(mean(xt(1:2))-0.025, line1+0.05, '*')
  73. elseif pv1 <=0.01 && pv1 > 0.001
  74. text(mean(xt(1:2))-0.05, line1+0.05, '**')
  75. elseif pv1 <= 0.001
  76. text(mean(xt(1:2))-0.15, line1+0.05, '***')
  77. else
  78. text(mean(xt(1:2))-0.05, line1+0.1, 'ns','FontSize',8)
  79. end
  80. if pv2 <= 0.05 && pv2 > 0.01
  81. text(mean(xt(3:4))-0.025, line1+0.05, '*')
  82. elseif pv2 <=0.01 && pv2 > 0.001
  83. text(mean(xt(3:4))-0.05, line1+0.05, '**')
  84. elseif pv2 <= 0.001
  85. text(mean(xt(3:4))-0.15, line1+0.05, '***')
  86. else
  87. text(mean(xt(3:4))-0.05, line1+0.1, 'ns','FontSize',8)
  88. end
  89. if pv3 <= 0.05 && pv3 > 0.01
  90. text(mean(xt(1:3))-0.025, line2+0.05, '*')
  91. elseif pv3 <=0.01 && pv3 > 0.001
  92. text(mean(xt(1:3))-0.05, line2+0.05, '**')
  93. elseif pv3 <= 0.001
  94. text(mean(xt(1:3))-0.15, line2+0.05, '***')
  95. else
  96. text(mean(xt(1:3))-0.05, line2+0.1, 'ns','FontSize',8)
  97. end
  98. if pv4 <= 0.05 && pv4 > 0.01
  99. text(mean(xt(2:4))-0.025, line3+0.05, '*')
  100. elseif pv4 <=0.01 && pv4 > 0.001
  101. text(mean(xt(2:4))-0.05, line3+0.05, '**')
  102. elseif pv4 <= 0.001
  103. text(mean(xt(2:4))-0.15, line3+0.05, '***')
  104. else
  105. text(mean(xt(2:4))-0.05, line3+0.1, 'ns','FontSize',8)
  106. end
  107. exportgraphics(gcf,'E:\Users\User\Desktop\delay paper\anesthetized\figures_paper\ce_nav.pdf',...
  108. 'Resolution',300','ContentType','vector','BackgroundColor','none')
  109. %% plotting number 2
  110. figure(2); set(gcf,'Position',[400 200 wid hei])
  111. ax = axes();
  112. hold(ax);
  113. for i=1:4
  114. h=boxchart(x(i)*ones(size(y2(:,i))), y2(:,i), 'BoxFaceColor', colors(i,:),'Notch','on');
  115. h.MarkerStyle='.';
  116. h.MarkerColor=colors(i,:);
  117. end
  118. hold on
  119. plot(1:2,nanmedian(y2(:,1:2)),'-o','LineWidth',1,'Color',blue,'MarkerSize',3,'MarkerFaceColor',blue)
  120. plot(3:4,nanmedian(y2(:,3:4)),'-o','LineWidth',1,'Color',red,'MarkerSize',3,'MarkerFaceColor',red)
  121. hold off
  122. xlim([0.5 4.5])
  123. ylabel('communication effect')
  124. xticklabels({'match','mismatch','match','mismatch'});
  125. set(gca, 'box', 'off')
  126. set(gca, 'Color','none')
  127. set(gca,'linewidth',1);set(gca,'fontsize',8);
  128. %% add stats
  129. pv1=signrank(y2(:,1),y2(:,2));
  130. pv2=signrank(y2(:,3),y2(:,4));
  131. pv3=ranksum(y2(:,1),y2(:,3));
  132. pv4=ranksum(y2(:,2),y2(:,4));
  133. xt = get(gca, 'XTick');
  134. % plot lines for comparison
  135. hold on
  136. plot(xt(1:2), [1 1]*line1, '-k','LineWidth',sl)
  137. plot([1;1]*xt(1),[line1,line1-0.05],'-k', 'LineWidth',sl);
  138. plot([1;1]*xt(2),[line1,line1-0.05],'-k', 'LineWidth',sl);
  139. plot(xt(3:4), [1 1]*line1, '-k','LineWidth',sl)
  140. plot([1;1]*xt(3),[line1,line1-0.05],'-k', 'LineWidth',sl);
  141. plot([1;1]*xt(4),[line1,line1-0.05],'-k', 'LineWidth',sl);
  142. plot([xt(1) xt(3)], [1 1]*line2, '-k','LineWidth',sl)
  143. plot([1;1]*xt(1),[line2,line2-0.05],'-k', 'LineWidth',sl);
  144. plot([1;1]*xt(3),[line2,line2-0.05],'-k', 'LineWidth',sl);
  145. plot([xt(2) xt(4)], [1 1]*line3, '-k','LineWidth',sl)
  146. plot([1;1]*xt(2),[line3,line3-0.05],'-k', 'LineWidth',sl);
  147. plot([1;1]*xt(4),[line3,line3-0.05],'-k', 'LineWidth',sl);
  148. ylim([-1 1])
  149. % plot level of significance
  150. if pv1 <= 0.05 && pv1 > 0.01
  151. text(mean(xt(1:2))-0.025, line1+0.05, '*')
  152. elseif pv1 <=0.01 && pv1 > 0.001
  153. text(mean(xt(1:2))-0.05, line1+0.05, '**')
  154. elseif pv1 <= 0.001
  155. text(mean(xt(1:2))-0.15, line1+0.05, '***')
  156. else
  157. text(mean(xt(1:2))-0.05, line1+0.1, 'ns','FontSize',8)
  158. end
  159. if pv2 <= 0.05 && pv2 > 0.01
  160. text(mean(xt(3:4))-0.025, line1+0.05, '*')
  161. elseif pv2 <=0.01 && pv2 > 0.001
  162. text(mean(xt(3:4))-0.05, line1+0.05, '**')
  163. elseif pv2 <= 0.001
  164. text(mean(xt(3:4))-0.15, line1+0.05, '***')
  165. else
  166. text(mean(xt(3:4))-0.05, line1+0.1, 'ns','FontSize',8)
  167. end
  168. if pv3 <= 0.05 && pv3 > 0.01
  169. text(mean(xt(1:3))-0.025, line2+0.05, '*')
  170. elseif pv3 <=0.01 && pv3 > 0.001
  171. text(mean(xt(1:3))-0.05, line2+0.05, '**')
  172. elseif pv3 <= 0.001
  173. text(mean(xt(1:3))-0.15, line2+0.05, '***')
  174. else
  175. text(mean(xt(1:3))-0.05, line2+0.1, 'ns','FontSize',8)
  176. end
  177. if pv4 <= 0.05 && pv4 > 0.01
  178. text(mean(xt(2:4))-0.025, line3+0.05, '*')
  179. elseif pv4 <=0.01 && pv4 > 0.001
  180. text(mean(xt(2:4))-0.05, line3+0.05, '**')
  181. elseif pv4 <= 0.001
  182. text(mean(xt(2:4))-0.15, line3+0.05, '***')
  183. else
  184. text(mean(xt(2:4))-0.05, line3+0.1, 'ns','FontSize',8)
  185. end
  186. exportgraphics(gcf,'E:\Users\User\Desktop\delay paper\anesthetized\figures_paper\ce_com.pdf',...
  187. 'Resolution',300','ContentType','vector','BackgroundColor','none')
  188. %% plotting number 3
  189. figure(3); set(gcf,'Position',[400 200 wid hei])
  190. ax = axes();
  191. hold(ax);
  192. for i=1:4
  193. h=boxchart(x(i)*ones(size(y3(:,i))), y3(:,i), 'BoxFaceColor', colors(i,:),'Notch','on');
  194. h.MarkerStyle='.';
  195. h.MarkerColor=colors(i,:);
  196. end
  197. hold on
  198. plot(1:2,nanmedian(y3(:,1:2)),'-o','LineWidth',1,'Color',blue,'MarkerSize',3,'MarkerFaceColor',blue)
  199. plot(3:4,nanmedian(y3(:,3:4)),'-o','LineWidth',1,'Color',red,'MarkerSize',3,'MarkerFaceColor',red)
  200. hold off
  201. xlim([0.5 4.5])
  202. ylabel('s.s.s.')
  203. xticklabels({'ech','com','ech','com'});
  204. set(gca, 'box', 'off')
  205. set(gca, 'Color','none')
  206. set(gca,'linewidth',1);set(gca,'fontsize',8);
  207. %% add stats
  208. pv1=signrank(y3(:,1),y3(:,2));
  209. pv2=signrank(y3(:,3),y3(:,4));
  210. pv3=ranksum(y3(:,1),y3(:,3));
  211. pv4=ranksum(y3(:,2),y3(:,4));
  212. pv5=signrank(y3(:,1));
  213. pv6=signrank(y3(:,2));
  214. pv7=signrank(y3(:,3));
  215. pv8=signrank(y3(:,4));
  216. xt = get(gca, 'XTick');
  217. % plot lines for comparison
  218. line1=0.45;
  219. hold on
  220. plot(xt(1:2), [1 1]*line1, '-k','LineWidth',sl)
  221. plot([1;1]*xt(1),[line1,line1-0.03],'-k', 'LineWidth',sl);
  222. plot([1;1]*xt(2),[line1,line1-0.03],'-k', 'LineWidth',sl);
  223. plot(xt(3:4), [1 1]*line1, '-k','LineWidth',sl)
  224. plot([1;1]*xt(3),[line1,line1-0.03],'-k', 'LineWidth',sl);
  225. plot([1;1]*xt(4),[line1,line1-0.03],'-k', 'LineWidth',sl);
  226. ylim([-0.5 0.55])
  227. % plot level of significance
  228. if pv1 <= 0.05 && pv1 > 0.01
  229. text(mean(xt(1:2))-0.025, line1+0.05, '*')
  230. elseif pv1 <=0.01 && pv1 > 0.001
  231. text(mean(xt(1:2))-0.05, line1+0.05, '**')
  232. elseif pv1 <= 0.001
  233. text(mean(xt(1:2))-0.15, line1+0.05, '***')
  234. else
  235. text(mean(xt(1:2))-0.05, line1+0.1, 'ns','FontSize',8)
  236. end
  237. if pv2 <= 0.05 && pv2 > 0.01
  238. text(mean(xt(3:4))-0.025, line1+0.05, '*')
  239. elseif pv2 <=0.01 && pv2 > 0.001
  240. text(mean(xt(3:4))-0.05, line1+0.05, '**')
  241. elseif pv2 <= 0.001
  242. text(mean(xt(3:4))-0.15, line1+0.05, '***')
  243. else
  244. text(mean(xt(3:4))-0.05, line1+0.1, 'ns','FontSize',8)
  245. end
  246. % add stats against null distribution
  247. line0=-0.45;
  248. if pv5 <= 0.05 && pv5 > 0.01
  249. text(xt(1), line0, '*','HorizontalAlignment','center')
  250. elseif pv5 <=0.01 && pv5 > 0.001
  251. text(xt(1), line0, '**','HorizontalAlignment','center')
  252. elseif pv5 <= 0.001
  253. text(xt(1), line0, '***','HorizontalAlignment','center')
  254. else
  255. text(xt(1), line0, 'ns','FontSize',8,'HorizontalAlignment','center')
  256. end
  257. if pv6 <= 0.05 && pv6 > 0.01
  258. text(xt(2), line0, '*','HorizontalAlignment','center')
  259. elseif pv6 <=0.01 && pv6 > 0.001
  260. text(xt(2), line0, '**','HorizontalAlignment','center')
  261. elseif pv6 <= 0.001
  262. text(xt(2), line0, '***','HorizontalAlignment','center')
  263. else
  264. text(xt(2), line0, 'ns','FontSize',8,'HorizontalAlignment','center')
  265. end
  266. if pv7 <= 0.07 && pv7 > 0.01
  267. text(xt(3), line0, '*','HorizontalAlignment','center')
  268. elseif pv7 <=0.01 && pv7 > 0.001
  269. text(xt(3), line0, '**','HorizontalAlignment','center')
  270. elseif pv7 <= 0.001
  271. text(xt(3), line0, '***','HorizontalAlignment','center')
  272. else
  273. text(xt(3), line0, 'ns','FontSize',8,'HorizontalAlignment','center')
  274. end
  275. if pv8 <= 0.05 && pv8 > 0.01
  276. text(xt(4), line0, '*','HorizontalAlignment','center')
  277. elseif pv8 <=0.01 && pv8 > 0.001
  278. text(xt(4), line0, '**','HorizontalAlignment','center')
  279. elseif pv8 <= 0.001
  280. text(xt(4), line0, '***','HorizontalAlignment','center')
  281. else
  282. text(xt(4), line0+0.03, 'ns','FontSize',8,'HorizontalAlignment','center')
  283. end
  284. % l=yline(0,'Color',[0.6 0.6 0.6], 'LineWidth',2);
  285. % uistack(l,'bottom')
  286. exportgraphics(gcf,'E:\Users\User\Desktop\delay paper\anesthetized\figures_paper\dd_boxplot.pdf',...
  287. 'Resolution',300','ContentType','vector','BackgroundColor','none')