Fig9E.m 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. clear;
  2. close all;
  3. % paired analysis per unit tested in different protocols
  4. load('pt_data.mat')
  5. c_=all_di(:,2)==0; % unit classification
  6. int_=all_di(:,3)==1; % intact: 1
  7. comp_=all_di(:,3)==2; % chimeras: 2 pure tones: 3
  8. particular=logical(c_.*int_);
  9. particular2=logical(c_.*comp_);
  10. % respective discriminability index
  11. di_iso=all_di(particular,4);
  12. di_nav=all_di(particular,5);
  13. di_com=all_di(particular,6);
  14. di_nav_comp=all_di(particular2,5);
  15. di_com_comp=all_di(particular2,6);
  16. y1=[di_nav,di_iso,di_nav_comp];
  17. y2=[di_com,di_iso,di_com_comp];
  18. % respective context effect index
  19. ce_nav_exp=all_di(particular,7);
  20. ce_nav_unexp=all_di(particular,8);
  21. ce_com_exp=all_di(particular,9);
  22. ce_com_unexp=all_di(particular,10);
  23. ce_nav_exp_comp=all_di(particular2,7);
  24. ce_nav_unexp_comp=all_di(particular2,8);
  25. ce_com_exp_comp=all_di(particular2,9);
  26. ce_com_unexp_comp=all_di(particular2,10);
  27. y3=[ce_nav_exp,ce_nav_exp_comp,ce_nav_unexp,ce_nav_unexp_comp];
  28. y4=[ce_com_exp,ce_com_exp_comp,ce_com_unexp,ce_com_unexp_comp];
  29. % respective deviance detection index
  30. dd_nav=ce_nav_unexp-ce_nav_exp;
  31. dd_com=ce_com_unexp-ce_com_exp;
  32. dd_nav_comp=ce_nav_unexp_comp-ce_nav_exp_comp;
  33. dd_com_comp=ce_com_unexp_comp-ce_com_exp_comp;
  34. y5=[dd_nav,dd_nav_comp,dd_com,dd_com_comp];
  35. % compare paired samples discriminability index
  36. pvA1=signrank(di_iso,di_nav);
  37. pvA2=signrank(di_iso,di_nav_comp);
  38. pvA3=signrank(di_iso,di_com);
  39. pvA4=signrank(di_iso,di_com_comp);
  40. % compare paired samples context effect index
  41. pvB1=signrank(ce_nav_exp,ce_nav_exp_comp);
  42. pvB2=signrank(ce_nav_unexp,ce_nav_unexp_comp);
  43. pvB3=signrank(ce_nav_exp,ce_nav_unexp);
  44. pvB4=signrank(ce_nav_exp_comp,ce_nav_unexp_comp);
  45. pvB5=signrank(ce_com_exp,ce_com_exp_comp);
  46. pvB6=signrank(ce_com_unexp,ce_com_unexp_comp);
  47. pvB7=signrank(ce_com_exp,ce_com_unexp);
  48. pvB8=signrank(ce_com_exp_comp,ce_com_unexp_comp);
  49. % compare paired samples discriminability index
  50. pvC1=signrank(dd_nav,dd_nav_comp);
  51. pvC2=signrank(dd_com,dd_com_comp);
  52. %% plot d.i. in isolation and after two different context
  53. red =[0.8500,0.3250, 0.0980];
  54. blue=[0,0.4470,0.7410];
  55. red_light=[1,0.5,0.5].*red;
  56. blue_light=[1,0.5,0.5].*blue;
  57. black=[0.2 0.2 0.2];
  58. green_light=[0.4863,0.3059,0.7098]; %green: [0.3922,0.8314,0.0745];
  59. green=[0.2980,0.1294,0.5098]; %[0.4667,0.6745,0.1882];
  60. lines_color=[0.7 0.7 0.7]; % light gray
  61. bar_colors=[blue; black; red];
  62. x = 1:3;
  63. figure(1); set(gcf,'Position',[400 200 200 250])
  64. ax = axes();
  65. hold(ax);
  66. for i=1:3
  67. h=boxchart(x(i)*ones(size(y1(:,i))), y1(:,i), 'BoxFaceColor', bar_colors(i,:),'Notch','off');
  68. h.MarkerStyle='.';
  69. h.MarkerColor=bar_colors(i,:);
  70. end
  71. % add lines per unit
  72. hold on
  73. for i=1:numel(di_iso)
  74. l=plot([1,2], [di_nav(i), di_iso(i)],'color',lines_color);
  75. uistack(l,'bottom')
  76. l=plot([2,3], [di_iso(i), di_nav_comp(i)],'color',lines_color);
  77. uistack(l,'bottom')
  78. end
  79. hold off
  80. xlim([0.5 3.5])
  81. ylabel('discriminability index')
  82. xticklabels({'intact','silence','chimera'});
  83. set(gca, 'box', 'off')
  84. set(gca, 'Color','none')
  85. set(gca,'linewidth',1);set(gca,'fontsize',8);
  86. xt = get(gca, 'XTick');
  87. line1=0.5;
  88. line2=0.7;
  89. sl=0.75;
  90. % plot lines for comparison
  91. hold on
  92. plot(xt(1:2), [1 1]*line1, '-k','LineWidth',sl)
  93. plot([1;1]*xt(1),[line1,line1-0.05],'-k', 'LineWidth',sl);
  94. plot([1;1]*xt(2),[line1,line1-0.05],'-k', 'LineWidth',sl);
  95. plot(xt(2:3), [1 1]*line2, '-k','LineWidth',sl)
  96. plot([1;1]*xt(2),[line2,line2-0.05],'-k', 'LineWidth',sl);
  97. plot([1;1]*xt(3),[line2,line2-0.05],'-k', 'LineWidth',sl);
  98. ylim([-1 1])
  99. % plot level of significance
  100. if pvA1 <= 0.05 && pvA1 > 0.01
  101. text(mean(xt(1:2))-0.025, line1+0.05, '*')
  102. elseif pvA1 <=0.01 && pvA1 > 0.001
  103. text(mean(xt(1:2))-0.05, line1+0.05, '**')
  104. elseif pvA1 <= 0.001
  105. text(mean(xt(1:2))-0.15, line1+0.05, '***')
  106. else
  107. text(mean(xt(1:2))-0.05, line1+0.075, 'ns','FontSize',8)
  108. end
  109. if pvA2 <= 0.05 && pvA2 > 0.01
  110. text(mean(xt(2:3))-0.025, line2+0.05, '*')
  111. elseif pvA2 <=0.01 && pvA2 > 0.001
  112. text(mean(xt(2:3))-0.05, line2+0.05, '**')
  113. elseif pvA2 <= 0.001
  114. text(mean(xt(2:2))-0.15, line2+0.05, '***')
  115. else
  116. text(mean(xt(2:3))-0.05, line2+0.075, 'ns','FontSize',8)
  117. end
  118. bar_colors=[blue; black; red];
  119. lines_color=[0.7 0.7 0.7]; % light gray
  120. x = 1:3;
  121. figure(2); set(gcf,'Position',[600 200 200 250])
  122. ax = axes();
  123. hold(ax);
  124. for i=1:3
  125. h=boxchart(x(i)*ones(size(y2(:,i))), y2(:,i), 'BoxFaceColor', bar_colors(i,:),'Notch','off');
  126. h.MarkerStyle='.';
  127. h.MarkerColor=bar_colors(i,:);
  128. end
  129. % add lines per unit
  130. hold on
  131. for i=1:numel(di_iso)
  132. l=plot([1,2], [di_com(i), di_iso(i)],'color',lines_color);
  133. uistack(l,'bottom')
  134. l=plot([2,3], [di_iso(i), di_com_comp(i)],'color',lines_color);
  135. uistack(l,'bottom')
  136. end
  137. hold off
  138. xlim([0.5 3.5])
  139. ylabel('discriminability index')
  140. xticklabels({'intact','silence','chimera'});
  141. set(gca, 'box', 'off')
  142. set(gca, 'Color','none')
  143. set(gca,'linewidth',1);set(gca,'fontsize',8);
  144. xt = get(gca, 'XTick');
  145. line1=0.5;
  146. line2=0.7;
  147. sl=0.75;
  148. % plot lines for comparison
  149. hold on
  150. plot(xt(1:2), [1 1]*line1, '-k','LineWidth',sl)
  151. plot([1;1]*xt(1),[line1,line1-0.05],'-k', 'LineWidth',sl);
  152. plot([1;1]*xt(2),[line1,line1-0.05],'-k', 'LineWidth',sl);
  153. plot(xt(2:3), [1 1]*line2, '-k','LineWidth',sl)
  154. plot([1;1]*xt(2),[line2,line2-0.05],'-k', 'LineWidth',sl);
  155. plot([1;1]*xt(3),[line2,line2-0.05],'-k', 'LineWidth',sl);
  156. ylim([-1 1])
  157. % plot level of significance
  158. if pvA3 <= 0.05 && pvA3 > 0.01
  159. text(mean(xt(1:2))-0.025, line1+0.05, '*')
  160. elseif pvA3 <=0.01 && pvA3 > 0.001
  161. text(mean(xt(1:2))-0.05, line1+0.05, '**')
  162. elseif pvA3 <= 0.001
  163. text(mean(xt(1:2))-0.15, line1+0.05, '***')
  164. else
  165. text(mean(xt(1:2))-0.05, line1+0.075, 'ns','FontSize',8)
  166. end
  167. if pvA4 <= 0.05 && pvA4 > 0.01
  168. text(mean(xt(2:3))-0.025, line2+0.05, '*')
  169. elseif pvA4 <=0.01 && pvA4 > 0.001
  170. text(mean(xt(2:3))-0.05, line2+0.05, '**')
  171. elseif pvA4 <= 0.001
  172. text(mean(xt(2:2))-0.15, line2+0.05, '***')
  173. else
  174. text(mean(xt(2:3))-0.05, line2+0.075, 'ns','FontSize',8)
  175. end
  176. %% plot c.e. for expected and unexpected probes after two different context
  177. bar_colors=[red;green_light;red_light;green];
  178. x = 1:4;
  179. figure(3); set(gcf,'Position',[400 200 160 180])
  180. ax = axes();
  181. hold(ax);
  182. for i=1:4
  183. h=boxchart(x(i)*ones(size(y3(:,i))), y3(:,i), 'BoxFaceColor', bar_colors(i,:),'Notch','off');
  184. h.MarkerStyle='.';
  185. h.MarkerColor=bar_colors(i,:);
  186. end
  187. % add lines per unit
  188. hold on
  189. for i=1:numel(ce_nav_exp)
  190. l=plot([1,2], [ce_nav_exp(i), ce_nav_exp_comp(i)],'color',lines_color);
  191. uistack(l,'bottom')
  192. l=plot([3,4], [ce_nav_unexp(i), ce_nav_unexp_comp(i)],'color',lines_color);
  193. uistack(l,'bottom')
  194. end
  195. hold off
  196. xlim([0.5 4.5])
  197. ylabel('echolocation effect')
  198. xticklabels({'match','match-fast','mismatch','mismatch-fast'});
  199. set(gca, 'box', 'off')
  200. set(gca, 'Color','none')
  201. set(gca,'linewidth',1);set(gca,'fontsize',8);
  202. xt = get(gca, 'XTick');
  203. line1=0.45;
  204. line2=0.65;
  205. line3=0.85;
  206. sl=0.75;
  207. % plot lines for comparison
  208. hold on
  209. plot(xt(1:2), [1 1]*line1, '-k','LineWidth',sl)
  210. plot([1;1]*xt(1),[line1,line1-0.05],'-k', 'LineWidth',sl);
  211. plot([1;1]*xt(2),[line1,line1-0.05],'-k', 'LineWidth',sl);
  212. plot(xt(3:4), [1 1]*line1, '-k','LineWidth',sl)
  213. plot([1;1]*xt(3),[line1,line1-0.05],'-k', 'LineWidth',sl);
  214. plot([1;1]*xt(4),[line1,line1-0.05],'-k', 'LineWidth',sl);
  215. plot([xt(1) xt(3)], [1 1]*line2, '-k','LineWidth',sl)
  216. plot([1;1]*xt(1),[line2,line2-0.05],'-k', 'LineWidth',sl);
  217. plot([1;1]*xt(3),[line2,line2-0.05],'-k', 'LineWidth',sl);
  218. plot([xt(2) xt(4)], [1 1]*line3, '-k','LineWidth',sl)
  219. plot([1;1]*xt(2),[line3,line3-0.05],'-k', 'LineWidth',sl);
  220. plot([1;1]*xt(4),[line3,line3-0.05],'-k', 'LineWidth',sl);
  221. ylim([-1.05 1])
  222. % plot level of significance
  223. if pvB1 <= 0.05 && pvB1 > 0.01
  224. text(mean(xt(1:2))-0.025, line1+0.05, '*')
  225. elseif pvB1 <=0.01 && pvB1 > 0.001
  226. text(mean(xt(1:2))-0.05, line1+0.05, '**')
  227. elseif pvB1 <= 0.001
  228. text(mean(xt(1:2))-0.15, line1+0.05, '***')
  229. else
  230. text(mean(xt(1:2))-0.05, line1+0.1, 'ns','FontSize',7)
  231. end
  232. if pvB2 <= 0.05 && pvB2 > 0.01
  233. text(mean(xt(3:4))-0.025, line1+0.05, '*')
  234. elseif pvB2 <=0.01 && pvB2 > 0.001
  235. text(mean(xt(3:4))-0.05, line1+0.05, '**')
  236. elseif pvB2 <= 0.001
  237. text(mean(xt(3:4))-0.15, line1+0.05, '***')
  238. else
  239. text(mean(xt(3:4))-0.05, line1+0.1, 'ns','FontSize',7)
  240. end
  241. if pvB3 <= 0.05 && pvB3 > 0.01
  242. text(mean(xt(1:3))-0.025, line2+0.05, '*')
  243. elseif pvB3 <=0.01 && pvB3 > 0.001
  244. text(mean(xt(1:3))-0.05, line2+0.05, '**')
  245. elseif pvB3 <= 0.001
  246. text(mean(xt(1:3))-0.15, line2+0.05, '***')
  247. else
  248. text(mean(xt(1:3))-0.05, line2+0.1, 'ns','FontSize',7)
  249. end
  250. if pvB4 <= 0.05 && pvB4 > 0.01
  251. text(mean(xt(2:4))-0.025, line3+0.05, '*')
  252. elseif pvB4 <=0.01 && pvB4 > 0.001
  253. text(mean(xt(2:4))-0.05, line3+0.05, '**')
  254. elseif pvB4 <= 0.001
  255. text(mean(xt(2:4))-0.15, line3+0.05, '***')
  256. else
  257. text(mean(xt(2:4))-0.05, line3+0.1, 'ns','FontSize',7)
  258. end
  259. exportgraphics(gcf,'E:\Users\User\Desktop\delay paper\anesthetized\figures_paper\sameunit_chi_nav.pdf',...
  260. 'Resolution',300','ContentType','vector','BackgroundColor','none')
  261. figure(4); set(gcf,'Position',[400 200 160 180])
  262. ax = axes();
  263. hold(ax);
  264. for i=1:4
  265. h=boxchart(x(i)*ones(size(y4(:,i))), y4(:,i), 'BoxFaceColor', bar_colors(i,:),'Notch','off');
  266. h.MarkerStyle='.';
  267. h.MarkerColor=bar_colors(i,:);
  268. end
  269. % add lines per unit
  270. hold on
  271. for i=1:numel(ce_nav_exp)
  272. l=plot([1,2], [ce_com_exp(i), ce_com_exp_comp(i)],'color',lines_color);
  273. uistack(l,'bottom')
  274. l=plot([3,4], [ce_com_unexp(i), ce_com_unexp_comp(i)],'color',lines_color);
  275. uistack(l,'bottom')
  276. end
  277. hold off
  278. xlim([0.5 4.5])
  279. ylim([-1.05, 0.4])
  280. ylabel('communication effect')
  281. xticklabels({'match','match-slow','mismatch','mismatch-slow'});
  282. set(gca, 'box', 'off')
  283. set(gca, 'Color','none')
  284. set(gca,'linewidth',1);set(gca,'fontsize',8);
  285. xt = get(gca, 'XTick');
  286. line1=0.45;
  287. line2=0.65;
  288. line3=0.85;
  289. sl=0.75;
  290. % plot lines for comparison
  291. hold on
  292. plot(xt(1:2), [1 1]*line1, '-k','LineWidth',sl)
  293. plot([1;1]*xt(1),[line1,line1-0.05],'-k', 'LineWidth',sl);
  294. plot([1;1]*xt(2),[line1,line1-0.05],'-k', 'LineWidth',sl);
  295. plot(xt(3:4), [1 1]*line1, '-k','LineWidth',sl)
  296. plot([1;1]*xt(3),[line1,line1-0.05],'-k', 'LineWidth',sl);
  297. plot([1;1]*xt(4),[line1,line1-0.05],'-k', 'LineWidth',sl);
  298. plot([xt(1) xt(3)], [1 1]*line2, '-k','LineWidth',sl)
  299. plot([1;1]*xt(1),[line2,line2-0.05],'-k', 'LineWidth',sl);
  300. plot([1;1]*xt(3),[line2,line2-0.05],'-k', 'LineWidth',sl);
  301. plot([xt(2) xt(4)], [1 1]*line3, '-k','LineWidth',sl)
  302. plot([1;1]*xt(2),[line3,line3-0.05],'-k', 'LineWidth',sl);
  303. plot([1;1]*xt(4),[line3,line3-0.05],'-k', 'LineWidth',sl);
  304. ylim([-1.05 1])
  305. % plot level of significance
  306. if pvB5 <= 0.05 && pvB5 > 0.01
  307. text(mean(xt(1:2))-0.025, line1+0.05, '*')
  308. elseif pvB5 <=0.01 && pvB5 > 0.001
  309. text(mean(xt(1:2))-0.05, line1+0.05, '**')
  310. elseif pvB5 <= 0.001
  311. text(mean(xt(1:2))-0.15, line1+0.05, '***')
  312. else
  313. text(mean(xt(1:2))-0.05, line1+0.1, 'ns','FontSize',7)
  314. end
  315. if pvB6 <= 0.05 && pvB6 > 0.01
  316. text(mean(xt(3:4))-0.025, line1+0.05, '*')
  317. elseif pvB6 <=0.01 && pvB6 > 0.001
  318. text(mean(xt(3:4))-0.05, line1+0.05, '**')
  319. elseif pvB6 <= 0.001
  320. text(mean(xt(3:4))-0.15, line1+0.05, '***')
  321. else
  322. text(mean(xt(3:4))-0.05, line1+0.1, 'ns','FontSize',7)
  323. end
  324. if pvB7 <= 0.05 && pvB7 > 0.01
  325. text(mean(xt(1:3))-0.025, line2+0.05, '*')
  326. elseif pvB7 <=0.01 && pvB7 > 0.001
  327. text(mean(xt(1:3))-0.05, line2+0.05, '**')
  328. elseif pvB7 <= 0.001
  329. text(mean(xt(1:3))-0.15, line2+0.05, '***')
  330. else
  331. text(mean(xt(1:3))-0.05, line2+0.1, 'ns','FontSize',7)
  332. end
  333. if pvB8 <= 0.05 && pvB8 > 0.01
  334. text(mean(xt(2:4))-0.025, line3+0.05, '*')
  335. elseif pvB8 <=0.01 && pvB8 > 0.001
  336. text(mean(xt(2:4))-0.05, line3+0.05, '**')
  337. elseif pvB8 <= 0.001
  338. text(mean(xt(2:4))-0.15, line3+0.05, '***')
  339. else
  340. text(mean(xt(2:4))-0.05, line3+0.1, 'ns','FontSize',7)
  341. end
  342. exportgraphics(gcf,'E:\Users\User\Desktop\delay paper\anesthetized\figures_paper\sameunit_chi_com.pdf',...
  343. 'Resolution',300','ContentType','vector','BackgroundColor','none')
  344. %% plot d.d. for different context after two different context
  345. bar_colors=[red_light;red;blue_light;blue];
  346. x = 1:4;
  347. figure(5); set(gcf,'Position',[400 200 250 250])
  348. ax = axes();
  349. hold(ax);
  350. for i=1:4
  351. h=boxchart(x(i)*ones(size(y5(:,i))), y5(:,i), 'BoxFaceColor', bar_colors(i,:),'Notch','off');
  352. h.MarkerStyle='.';
  353. h.MarkerColor=bar_colors(i,:);
  354. end
  355. % add lines per unit
  356. hold on
  357. for i=1:numel(dd_nav)
  358. l=plot([1,2], [dd_nav(i), dd_nav_comp(i)],'color',lines_color);
  359. uistack(l,'bottom')
  360. l=plot([3,4], [dd_com(i), dd_com_comp(i)],'color',lines_color);
  361. uistack(l,'bottom')
  362. end
  363. hold off
  364. xlim([0.5 4.5])
  365. ylabel('deviance detection')
  366. xticklabels({'intact','chimera','intact','chimera'});
  367. set(gca, 'box', 'off')
  368. set(gca, 'Color','none')
  369. set(gca,'linewidth',1);set(gca,'fontsize',8);
  370. xt = get(gca, 'XTick');
  371. line1=0.75;
  372. sl=0.75;
  373. % plot lines for comparison
  374. hold on
  375. plot(xt(1:2), [1 1]*line1, '-k','LineWidth',sl)
  376. plot([1;1]*xt(1),[line1,line1-0.05],'-k', 'LineWidth',sl);
  377. plot([1;1]*xt(2),[line1,line1-0.05],'-k', 'LineWidth',sl);
  378. plot(xt(3:4), [1 1]*line1, '-k','LineWidth',sl)
  379. plot([1;1]*xt(3),[line1,line1-0.05],'-k', 'LineWidth',sl);
  380. plot([1;1]*xt(4),[line1,line1-0.05],'-k', 'LineWidth',sl);
  381. ylim([-0.75 1])
  382. % plot level of significance
  383. if pvC1 <= 0.05 && pvC1 > 0.01
  384. text(mean(xt(1:2))-0.025, line1+0.05, '*')
  385. elseif pvC1 <=0.01 && pvC1 > 0.001
  386. text(mean(xt(1:2))-0.05, line1+0.05, '**')
  387. elseif pvC1 <= 0.001
  388. text(mean(xt(1:2))-0.15, line1+0.05, '***')
  389. else
  390. text(mean(xt(1:2))-0.05, line1+0.075, 'ns','FontSize',8)
  391. end
  392. if pvC2 <= 0.05 && pvC2 > 0.01
  393. text(mean(xt(3:4))-0.025, line1+0.05, '*')
  394. elseif pvC2 <=0.01 && pvC2 > 0.001
  395. text(mean(xt(3:4))-0.05, line1+0.05, '**')
  396. elseif pvC2 <= 0.001
  397. text(mean(xt(3:4))-0.15, line1+0.05, '***')
  398. else
  399. text(mean(xt(3:4))-0.05, line1+0.075, 'ns','FontSize',8)
  400. end