SFig7A.m 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. clear;
  2. close all;
  3. % paired analysis per unit tested in different protocols
  4. load('pair_data.mat')
  5. class_=all_di(:,2)==0; % unit classification
  6. paired_=logical([1;1;1;1;1;1;0;0;0;0;0;0;0;0;0;1;1;0;1;1;1;1;1;1;0;0;1;1]);
  7. aw_=all_di(:,3)==0; % awake data
  8. an_=all_di(:,3)==1; % aneshetized data
  9. particular=logical(aw_);
  10. an_units=all_di(particular,1)+1;
  11. particular2=ismember(all_di(:,1),an_units);
  12. n=0; % 0: for 60ms delay and 3: for 416ms delay
  13. c=0; % 0: for 60ms delay and 4: for 416ms delay
  14. % respective discriminability index
  15. di_iso=all_di(particular,4+n);
  16. di_nav=all_di(particular,5+n);
  17. di_com=all_di(particular,6+n);
  18. di_iso_comp=all_di(particular2,4+n);
  19. di_nav_comp=all_di(particular2,5+n);
  20. di_com_comp=all_di(particular2,6+n);
  21. y1=[di_nav,di_iso,di_iso_comp,di_nav_comp];
  22. y2=[di_com,di_iso,di_iso_comp,di_com_comp];
  23. % respective context effect index
  24. ce_nav_exp=all_di(particular,10+c);
  25. ce_nav_unexp=all_di(particular,11+c);
  26. ce_com_exp=all_di(particular,12+c);
  27. ce_com_unexp=all_di(particular,13+c);
  28. ce_nav_exp_comp=all_di(particular2,10+c);
  29. ce_nav_unexp_comp=all_di(particular2,11+c);
  30. ce_com_exp_comp=all_di(particular2,12+c);
  31. ce_com_unexp_comp=all_di(particular2,13+c);
  32. y3=[ce_nav_exp,ce_nav_exp_comp,ce_nav_unexp,ce_nav_unexp_comp];
  33. y4=[ce_com_exp,ce_com_exp_comp,ce_com_unexp,ce_com_unexp_comp];
  34. % respective deviance detection index
  35. dd_nav=ce_nav_unexp-ce_nav_exp;
  36. dd_com=ce_com_unexp-ce_com_exp;
  37. dd_nav_comp=ce_nav_unexp_comp-ce_nav_exp_comp;
  38. dd_com_comp=ce_com_unexp_comp-ce_com_exp_comp;
  39. y5=[dd_nav,dd_nav_comp,dd_com,dd_com_comp];
  40. % respective spikecounts in isolation
  41. sp_nav=all_di(particular,18);
  42. sp_com=all_di(particular,19);
  43. sp_nav_comp=all_di(particular2,18);
  44. sp_com_comp=all_di(particular2,19);
  45. y6=[sp_nav,sp_nav_comp,sp_com,sp_com_comp];
  46. % compare paired samples discriminability index
  47. pvA1=signrank(di_iso,di_nav);
  48. pvA2=signrank(di_iso_comp,di_nav_comp);
  49. pvA3=signrank(di_iso,di_com);
  50. pvA4=signrank(di_iso_comp,di_com_comp);
  51. pvA5=signrank(di_nav,di_nav_comp);
  52. pvA6=signrank(di_com,di_com_comp);
  53. % compare paired samples context effect index
  54. pvB1=signrank(ce_nav_exp,ce_nav_exp_comp);
  55. pvB2=signrank(ce_nav_unexp,ce_nav_unexp_comp);
  56. pvB3=signrank(ce_nav_exp,ce_nav_unexp);
  57. pvB4=signrank(ce_nav_exp_comp,ce_nav_unexp_comp);
  58. pvB5=signrank(ce_com_exp,ce_com_exp_comp);
  59. pvB6=signrank(ce_com_unexp,ce_com_unexp_comp);
  60. pvB7=signrank(ce_com_exp,ce_com_unexp);
  61. pvB8=signrank(ce_com_exp_comp,ce_com_unexp_comp);
  62. % compare paired samples discriminability index
  63. pvC1=signrank(dd_nav,dd_nav_comp);
  64. pvC2=signrank(dd_com,dd_com_comp);
  65. % compare paired samples spikecounts
  66. pvD1=signrank(sp_nav,sp_nav_comp);
  67. pvD2=signrank(sp_com,sp_com_comp);
  68. %% plot d.i. in isolation and after two different context
  69. red =[0.8500,0.3250, 0.0980];
  70. blue=[0,0.4470,0.7410];
  71. red_light=[1,0.5,0.5].*red;
  72. blue_light=[1,0.5,0.5].*blue;
  73. black=[0.2 0.2 0.2];
  74. lines_color=[0.7 0.7 0.7]; % light gray
  75. bar_colors=[blue_light; black; black; blue];
  76. x = 1:4;
  77. figure(1); set(gcf,'Position',[400 200 200 250])
  78. ax = axes();
  79. hold(ax);
  80. for i=1:4
  81. h=boxchart(x(i)*ones(size(y1(:,i))), y1(:,i), 'BoxFaceColor', bar_colors(i,:),'Notch','off');
  82. h.MarkerStyle='.';
  83. h.MarkerColor=bar_colors(i,:);
  84. end
  85. % add lines per unit
  86. hold on
  87. for i=1:numel(di_iso)
  88. l=plot([1,2], [di_nav(i), di_iso(i)],'color',lines_color);
  89. uistack(l,'bottom')
  90. l=plot([3,4], [di_iso_comp(i), di_nav_comp(i)],'color',lines_color);
  91. uistack(l,'bottom')
  92. end
  93. hold off
  94. xlim([0.5 4.5])
  95. ylabel('discriminability index')
  96. xticklabels({'bef-nav','bef-sil','aft-sil','aft-nav'});
  97. set(gca, 'box', 'off')
  98. set(gca, 'Color','none')
  99. set(gca,'linewidth',1);set(gca,'fontsize',8);
  100. xt = get(gca, 'XTick');
  101. line1=0.9;
  102. line2=1.1;
  103. sl=0.75;
  104. % plot lines for comparison
  105. hold on
  106. plot(xt(1:2), [1 1]*line1, '-k','LineWidth',sl)
  107. plot([1;1]*xt(1),[line1,line1-0.05],'-k', 'LineWidth',sl);
  108. plot([1;1]*xt(2),[line1,line1-0.05],'-k', 'LineWidth',sl);
  109. plot(xt(3:4), [1 1]*line1, '-k','LineWidth',sl)
  110. plot([1;1]*xt(3),[line1,line1-0.05],'-k', 'LineWidth',sl);
  111. plot([1;1]*xt(4),[line1,line1-0.05],'-k', 'LineWidth',sl);
  112. plot([xt(1) xt(4)], [1 1]*line2, '-k','LineWidth',sl)
  113. plot([1;1]*xt(1),[line2,line2-0.05],'-k', 'LineWidth',sl);
  114. plot([1;1]*xt(4),[line2,line2-0.05],'-k', 'LineWidth',sl);
  115. ylim([-1 1.3])
  116. % plot level of significance
  117. if pvA1 <= 0.05 && pvA1 > 0.01
  118. text(mean(xt(1:2))-0.025, line1+0.05, '*')
  119. elseif pvA1 <=0.01 && pvA1 > 0.001
  120. text(mean(xt(1:2))-0.05, line1+0.05, '**')
  121. elseif pvA1 <= 0.001
  122. text(mean(xt(1:2))-0.15, line1+0.05, '***')
  123. else
  124. text(mean(xt(1:2))-0.05, line1+0.075, 'ns','FontSize',8)
  125. end
  126. if pvA2 <= 0.05 && pvA2 > 0.01
  127. text(mean(xt(3:4))-0.025, line12+0.05, '*')
  128. elseif pvA2 <=0.01 && pvA2 > 0.001
  129. text(mean(xt(3:4))-0.05, line1+0.05, '**')
  130. elseif pvA2 <= 0.001
  131. text(mean(xt(3:4))-0.15, line1+0.05, '***')
  132. else
  133. text(mean(xt(3:4))-0.05, line1+0.075, 'ns','FontSize',8)
  134. end
  135. if pvA5 <= 0.05 && pvA5 > 0.01
  136. text(mean(xt(1:4))-0.025, line2+0.05, '*')
  137. elseif pvA5 <=0.01 && pvA5 > 0.001
  138. text(mean(xt(1:4))-0.05, line21+0.05, '**')
  139. elseif pvA5 <= 0.001
  140. text(mean(xt(1:4))-0.15, line2+0.05, '***')
  141. else
  142. text(mean(xt(1:4))-0.05, line2+0.075, 'ns','FontSize',8)
  143. end
  144. bar_colors=[red_light; black; black; red];
  145. lines_color=[0.7 0.7 0.7]; % light gray
  146. x = 1:4;
  147. figure(2); set(gcf,'Position',[600 200 200 250])
  148. ax = axes();
  149. hold(ax);
  150. for i=1:4
  151. h=boxchart(x(i)*ones(size(y2(:,i))), y2(:,i), 'BoxFaceColor', bar_colors(i,:),'Notch','off');
  152. h.MarkerStyle='.';
  153. h.MarkerColor=bar_colors(i,:);
  154. end
  155. % add lines per unit
  156. hold on
  157. for i=1:numel(di_iso)
  158. l=plot([1,2], [di_com(i), di_iso(i)],'color',lines_color);
  159. uistack(l,'bottom')
  160. l=plot([3,4], [di_iso(i), di_com_comp(i)],'color',lines_color);
  161. uistack(l,'bottom')
  162. end
  163. hold off
  164. xlim([0.5 4.5])
  165. ylabel('discriminability index')
  166. xticklabels({'bef-com','bef-sil','aft-sil','aft-com'});
  167. set(gca, 'box', 'off')
  168. set(gca, 'Color','none')
  169. set(gca,'linewidth',1);set(gca,'fontsize',8);
  170. xt = get(gca, 'XTick');
  171. line1=0.9;
  172. line2=1.1;
  173. sl=0.75;
  174. % plot lines for comparison
  175. hold on
  176. plot(xt(1:2), [1 1]*line1, '-k','LineWidth',sl)
  177. plot([1;1]*xt(1),[line1,line1-0.05],'-k', 'LineWidth',sl);
  178. plot([1;1]*xt(2),[line1,line1-0.05],'-k', 'LineWidth',sl);
  179. plot(xt(3:4), [1 1]*line1, '-k','LineWidth',sl)
  180. plot([1;1]*xt(3),[line1,line1-0.05],'-k', 'LineWidth',sl);
  181. plot([1;1]*xt(4),[line1,line1-0.05],'-k', 'LineWidth',sl);
  182. plot([xt(1) xt(4)], [1 1]*line2, '-k','LineWidth',sl)
  183. plot([1;1]*xt(1),[line2,line2-0.05],'-k', 'LineWidth',sl);
  184. plot([1;1]*xt(4),[line2,line2-0.05],'-k', 'LineWidth',sl);
  185. ylim([-1 1.3])
  186. % plot level of significance
  187. if pvA3 <= 0.05 && pvA3 > 0.01
  188. text(mean(xt(1:2))-0.025, line1+0.05, '*')
  189. elseif pvA3 <=0.01 && pvA3 > 0.001
  190. text(mean(xt(1:2))-0.05, line1+0.05, '**')
  191. elseif pvA3 <= 0.001
  192. text(mean(xt(1:2))-0.15, line1+0.05, '***')
  193. else
  194. text(mean(xt(1:2))-0.05, line1+0.075, 'ns','FontSize',8)
  195. end
  196. if pvA4 <= 0.05 && pvA4 > 0.01
  197. text(mean(xt(3:4))-0.025, line1+0.05, '*')
  198. elseif pvA4 <=0.01 && pvA4 > 0.001
  199. text(mean(xt(3:4))-0.05, line1+0.05, '**')
  200. elseif pvA4 <= 0.001
  201. text(mean(xt(3:4))-0.15, line1+0.05, '***')
  202. else
  203. text(mean(xt(3:4))-0.05, line1+0.075, 'ns','FontSize',8)
  204. end
  205. if pvA6 <= 0.05 && pvA6 > 0.01
  206. text(mean(xt(1:4))-0.025, line2+0.05, '*')
  207. elseif pvA6 <=0.01 && pvA6 > 0.001
  208. text(mean(xt(1:4))-0.05, line21+0.05, '**')
  209. elseif pvA6 <= 0.001
  210. text(mean(xt(1:4))-0.15, line2+0.05, '***')
  211. else
  212. text(mean(xt(1:4))-0.05, line2+0.075, 'ns','FontSize',8)
  213. end
  214. %% plot c.e. for expected and unexpected probes after two different context
  215. bar_colors=[blue;red;blue_light;red_light];
  216. x = 1:4;
  217. figure(3); set(gcf,'Position',[400 200 200 200])
  218. ax = axes();
  219. hold(ax);
  220. for i=1:4
  221. h=boxchart(x(i)*ones(size(y3(:,i))), y3(:,i), 'BoxFaceColor', bar_colors(i,:),'Notch','off');
  222. h.MarkerStyle='.';
  223. h.MarkerColor=bar_colors(i,:);
  224. end
  225. % add lines per unit
  226. hold on
  227. for i=1:numel(ce_nav_exp)
  228. l=plot([1,2], [ce_nav_exp(i), ce_nav_exp_comp(i)],'color',lines_color);
  229. uistack(l,'bottom')
  230. l=plot([3,4], [ce_nav_unexp(i), ce_nav_unexp_comp(i)],'color',lines_color);
  231. uistack(l,'bottom')
  232. end
  233. hold off
  234. xlim([0.5 4.5])
  235. ylabel('echolocation effect')
  236. xticklabels({'match-aw','match-an','mismatch-aw','mismatch-an'});
  237. set(gca, 'box', 'off')
  238. set(gca, 'Color','none')
  239. set(gca,'linewidth',1);set(gca,'fontsize',8);
  240. xt = get(gca, 'XTick');
  241. line1=0.45;
  242. line2=0.65;
  243. line3=0.85;
  244. sl=0.75;
  245. % plot lines for comparison
  246. hold on
  247. plot(xt(1:2), [1 1]*line1, '-k','LineWidth',sl)
  248. plot([1;1]*xt(1),[line1,line1-0.05],'-k', 'LineWidth',sl);
  249. plot([1;1]*xt(2),[line1,line1-0.05],'-k', 'LineWidth',sl);
  250. plot(xt(3:4), [1 1]*line1, '-k','LineWidth',sl)
  251. plot([1;1]*xt(3),[line1,line1-0.05],'-k', 'LineWidth',sl);
  252. plot([1;1]*xt(4),[line1,line1-0.05],'-k', 'LineWidth',sl);
  253. % plot([xt(1) xt(3)], [1 1]*line2, '-k','LineWidth',sl)
  254. % plot([1;1]*xt(1),[line2,line2-0.05],'-k', 'LineWidth',sl);
  255. % plot([1;1]*xt(3),[line2,line2-0.05],'-k', 'LineWidth',sl);
  256. %
  257. % plot([xt(2) xt(4)], [1 1]*line3, '-k','LineWidth',sl)
  258. % plot([1;1]*xt(2),[line3,line3-0.05],'-k', 'LineWidth',sl);
  259. % plot([1;1]*xt(4),[line3,line3-0.05],'-k', 'LineWidth',sl);
  260. ylim([-1.05 0.7])
  261. % % plot level of significance
  262. % if pvB1 <= 0.05 && pvB1 > 0.01
  263. % text(mean(xt(1:2))-0.025, line1+0.05, '*')
  264. % elseif pvB1 <=0.01 && pvB1 > 0.001
  265. % text(mean(xt(1:2))-0.05, line1+0.05, '**')
  266. % elseif pvB1 <= 0.001
  267. % text(mean(xt(1:2))-0.15, line1+0.05, '***')
  268. % else
  269. % text(mean(xt(1:2))-0.05, line1+0.1, 'ns','FontSize',7)
  270. % end
  271. %
  272. % if pvB2 <= 0.05 && pvB2 > 0.01
  273. % text(mean(xt(3:4))-0.025, line1+0.05, '*')
  274. % elseif pvB2 <=0.01 && pvB2 > 0.001
  275. % text(mean(xt(3:4))-0.05, line1+0.05, '**')
  276. % elseif pvB2 <= 0.001
  277. % text(mean(xt(3:4))-0.15, line1+0.05, '***')
  278. % else
  279. % text(mean(xt(3:4))-0.05, line1+0.1, 'ns','FontSize',7)
  280. % end
  281. %
  282. %
  283. % if pvB3 <= 0.05 && pvB3 > 0.01
  284. % text(mean(xt(1:3))-0.025, line2+0.05, '*')
  285. % elseif pvB3 <=0.01 && pvB3 > 0.001
  286. % text(mean(xt(1:3))-0.05, line2+0.05, '**')
  287. % elseif pvB3 <= 0.001
  288. % text(mean(xt(1:3))-0.15, line2+0.05, '***')
  289. % else
  290. % text(mean(xt(1:3))-0.05, line2+0.1, 'ns','FontSize',7)
  291. % end
  292. %
  293. %
  294. % if pvB4 <= 0.05 && pvB4 > 0.01
  295. % text(mean(xt(2:4))-0.025, line3+0.05, '*')
  296. % elseif pvB4 <=0.01 && pvB4 > 0.001
  297. % text(mean(xt(2:4))-0.05, line3+0.05, '**')
  298. % elseif pvB4 <= 0.001
  299. % text(mean(xt(2:4))-0.15, line3+0.05, '***')
  300. % else
  301. % text(mean(xt(2:4))-0.05, line3+0.1, 'ns','FontSize',7)
  302. % end
  303. exportgraphics(gcf,'E:\Users\User\Desktop\delay paper\anesthetized\figures_paper\sameunit_inj_nav.pdf',...
  304. 'Resolution',300','ContentType','vector','BackgroundColor','none')
  305. figure(4); set(gcf,'Position',[400 200 200 200])
  306. ax = axes();
  307. hold(ax);
  308. for i=1:4
  309. h=boxchart(x(i)*ones(size(y4(:,i))), y4(:,i), 'BoxFaceColor', bar_colors(i,:),'Notch','off');
  310. h.MarkerStyle='.';
  311. h.MarkerColor=bar_colors(i,:);
  312. end
  313. % add lines per unit
  314. hold on
  315. for i=1:numel(ce_nav_exp)
  316. l=plot([1,2], [ce_com_exp(i), ce_com_exp_comp(i)],'color',lines_color);
  317. uistack(l,'bottom')
  318. l=plot([3,4], [ce_com_unexp(i), ce_com_unexp_comp(i)],'color',lines_color);
  319. uistack(l,'bottom')
  320. end
  321. hold off
  322. xlim([0.5 4.5])
  323. ylim([-1.05, 0.4])
  324. ylabel('communication effect')
  325. xticklabels({'match-aw','match-an','mismatch-aw','mismatch-an'});
  326. set(gca, 'box', 'off')
  327. set(gca, 'Color','none')
  328. set(gca,'linewidth',1);set(gca,'fontsize',8);
  329. xt = get(gca, 'XTick');
  330. line1=0.45;
  331. line2=0.65;
  332. line3=0.85;
  333. sl=0.75;
  334. % plot lines for comparison
  335. hold on
  336. plot(xt(1:2), [1 1]*line1, '-k','LineWidth',sl)
  337. plot([1;1]*xt(1),[line1,line1-0.05],'-k', 'LineWidth',sl);
  338. plot([1;1]*xt(2),[line1,line1-0.05],'-k', 'LineWidth',sl);
  339. plot(xt(3:4), [1 1]*line1, '-k','LineWidth',sl)
  340. plot([1;1]*xt(3),[line1,line1-0.05],'-k', 'LineWidth',sl);
  341. plot([1;1]*xt(4),[line1,line1-0.05],'-k', 'LineWidth',sl);
  342. % plot([xt(1) xt(3)], [1 1]*line2, '-k','LineWidth',sl)
  343. % plot([1;1]*xt(1),[line2,line2-0.05],'-k', 'LineWidth',sl);
  344. % plot([1;1]*xt(3),[line2,line2-0.05],'-k', 'LineWidth',sl);
  345. %
  346. % plot([xt(2) xt(4)], [1 1]*line3, '-k','LineWidth',sl)
  347. % plot([1;1]*xt(2),[line3,line3-0.05],'-k', 'LineWidth',sl);
  348. % plot([1;1]*xt(4),[line3,line3-0.05],'-k', 'LineWidth',sl);
  349. %
  350. ylim([-1.05 0.7])
  351. %
  352. % % plot level of significance
  353. % if pvB5 <= 0.05 && pvB5 > 0.01
  354. % text(mean(xt(1:2))-0.025, line1+0.05, '*')
  355. % elseif pvB5 <=0.01 && pvB5 > 0.001
  356. % text(mean(xt(1:2))-0.05, line1+0.05, '**')
  357. % elseif pvB5 <= 0.001
  358. % text(mean(xt(1:2))-0.15, line1+0.05, '***')
  359. % else
  360. % text(mean(xt(1:2))-0.05, line1+0.1, 'ns','FontSize',7)
  361. % end
  362. %
  363. % if pvB6 <= 0.05 && pvB6 > 0.01
  364. % text(mean(xt(3:4))-0.025, line1+0.05, '*')
  365. % elseif pvB6 <=0.01 && pvB6 > 0.001
  366. % text(mean(xt(3:4))-0.05, line1+0.05, '**')
  367. % elseif pvB6 <= 0.001
  368. % text(mean(xt(3:4))-0.15, line1+0.05, '***')
  369. % else
  370. % text(mean(xt(3:4))-0.05, line1+0.1, 'ns','FontSize',7)
  371. % end
  372. %
  373. %
  374. % if pvB7 <= 0.05 && pvB7 > 0.01
  375. % text(mean(xt(1:3))-0.025, line2+0.05, '*')
  376. % elseif pvB7 <=0.01 && pvB7 > 0.001
  377. % text(mean(xt(1:3))-0.05, line2+0.05, '**')
  378. % elseif pvB7 <= 0.001
  379. % text(mean(xt(1:3))-0.15, line2+0.05, '***')
  380. % else
  381. % text(mean(xt(1:3))-0.05, line2+0.1, 'ns','FontSize',7)
  382. % end
  383. %
  384. %
  385. % if pvB8 <= 0.05 && pvB8 > 0.01
  386. % text(mean(xt(2:4))-0.025, line3+0.05, '*')
  387. % elseif pvB8 <=0.01 && pvB8 > 0.001
  388. % text(mean(xt(2:4))-0.05, line3+0.05, '**')
  389. % elseif pvB8 <= 0.001
  390. % text(mean(xt(2:4))-0.15, line3+0.05, '***')
  391. % else
  392. % text(mean(xt(2:4))-0.05, line3+0.1, 'ns','FontSize',7)
  393. % end
  394. exportgraphics(gcf,'E:\Users\User\Desktop\delay paper\anesthetized\figures_paper\sameunit_inj_com.pdf',...
  395. 'Resolution',300','ContentType','vector','BackgroundColor','none')
  396. %% plot d.d. for different context after two different context
  397. bar_colors=[blue_light;blue;red_light;red];
  398. x = 1:4;
  399. figure(5); set(gcf,'Position',[400 200 250 250])
  400. ax = axes();
  401. hold(ax);
  402. for i=1:4
  403. h=boxchart(x(i)*ones(size(y5(:,i))), y5(:,i), 'BoxFaceColor', bar_colors(i,:),'Notch','off');
  404. h.MarkerStyle='.';
  405. h.MarkerColor=bar_colors(i,:);
  406. end
  407. % add lines per unit
  408. hold on
  409. for i=1:numel(dd_nav)
  410. l=plot([1,2], [dd_nav(i), dd_nav_comp(i)],'color',lines_color);
  411. uistack(l,'bottom')
  412. l=plot([3,4], [dd_com(i), dd_com_comp(i)],'color',lines_color);
  413. uistack(l,'bottom')
  414. end
  415. hold off
  416. xlim([0.5 4.5])
  417. ylabel('deviance detection')
  418. xticklabels({'before','after','before','after'});
  419. set(gca, 'box', 'off')
  420. set(gca, 'Color','none')
  421. set(gca,'linewidth',1);set(gca,'fontsize',8);
  422. xt = get(gca, 'XTick');
  423. line1=0.75;
  424. sl=0.75;
  425. % plot lines for comparison
  426. hold on
  427. plot(xt(1:2), [1 1]*line1, '-k','LineWidth',sl)
  428. plot([1;1]*xt(1),[line1,line1-0.05],'-k', 'LineWidth',sl);
  429. plot([1;1]*xt(2),[line1,line1-0.05],'-k', 'LineWidth',sl);
  430. plot(xt(3:4), [1 1]*line1, '-k','LineWidth',sl)
  431. plot([1;1]*xt(3),[line1,line1-0.05],'-k', 'LineWidth',sl);
  432. plot([1;1]*xt(4),[line1,line1-0.05],'-k', 'LineWidth',sl);
  433. ylim([-0.75 1])
  434. % plot level of significance
  435. if pvC1 <= 0.05 && pvC1 > 0.01
  436. text(mean(xt(1:2))-0.025, line1+0.05, '*')
  437. elseif pvC1 <=0.01 && pvC1 > 0.001
  438. text(mean(xt(1:2))-0.05, line1+0.05, '**')
  439. elseif pvC1 <= 0.001
  440. text(mean(xt(1:2))-0.15, line1+0.05, '***')
  441. else
  442. text(mean(xt(1:2))-0.05, line1+0.075, 'ns','FontSize',8)
  443. end
  444. if pvC2 <= 0.05 && pvC2 > 0.01
  445. text(mean(xt(3:4))-0.025, line1+0.05, '*')
  446. elseif pvC2 <=0.01 && pvC2 > 0.001
  447. text(mean(xt(3:4))-0.05, line1+0.05, '**')
  448. elseif pvC2 <= 0.001
  449. text(mean(xt(3:4))-0.15, line1+0.05, '***')
  450. else
  451. text(mean(xt(3:4))-0.05, line1+0.075, 'ns','FontSize',8)
  452. end
  453. %% plot spikecounts of each probe after two different context
  454. bar_colors=[blue_light;blue;red_light;red];
  455. x = 1:4;
  456. figure(6); set(gcf,'Position',[400 200 250 250])
  457. ax = axes();
  458. hold(ax);
  459. for i=1:4
  460. h=boxchart(x(i)*ones(size(y6(:,i))), y6(:,i), 'BoxFaceColor', bar_colors(i,:),'Notch','off');
  461. h.MarkerStyle='.';
  462. h.MarkerColor=bar_colors(i,:);
  463. end
  464. % add lines per unit
  465. hold on
  466. for i=1:numel(dd_nav)
  467. l=plot([1,2], [sp_nav(i), sp_nav_comp(i)],'color',lines_color);
  468. uistack(l,'bottom')
  469. l=plot([3,4], [sp_com(i), sp_com_comp(i)],'color',lines_color);
  470. uistack(l,'bottom')
  471. end
  472. hold off
  473. xlim([0.5 4.5])
  474. ylabel('# spikes in 50 ms')
  475. xticklabels({'before','after','before','after'});
  476. set(gca, 'box', 'off')
  477. set(gca, 'Color','none')
  478. set(gca,'linewidth',1);set(gca,'fontsize',8);
  479. xt = get(gca, 'XTick');
  480. line1=15;
  481. sl=0.75;
  482. % plot lines for comparison
  483. hold on
  484. plot(xt(1:2), [1 1]*line1, '-k','LineWidth',sl)
  485. plot([1;1]*xt(1),[line1,line1-0.5],'-k', 'LineWidth',sl);
  486. plot([1;1]*xt(2),[line1,line1-0.5],'-k', 'LineWidth',sl);
  487. plot(xt(3:4), [1 1]*line1, '-k','LineWidth',sl)
  488. plot([1;1]*xt(3),[line1,line1-0.5],'-k', 'LineWidth',sl);
  489. plot([1;1]*xt(4),[line1,line1-0.5],'-k', 'LineWidth',sl);
  490. ylim([0 17])
  491. % plot level of significance
  492. if pvD1 <= 0.05 && pvD1 > 0.01
  493. text(mean(xt(1:2))-0.025, line1+0.5, '*')
  494. elseif pvD1 <=0.01 && pvD1 > 0.001
  495. text(mean(xt(1:2))-0.05, line1+0.5, '**')
  496. elseif pvD1 <= 0.001
  497. text(mean(xt(1:2))-0.15, line1+0.5, '***')
  498. else
  499. text(mean(xt(1:2))-0.05, line1+0.75, 'ns','FontSize',8)
  500. end
  501. if pvD2 <= 0.05 && pvD2 > 0.01
  502. text(mean(xt(3:4))-0.025, line1+0.5, '*')
  503. elseif pvD2 <=0.01 && pvD2 > 0.001
  504. text(mean(xt(3:4))-0.05, line1+0.5, '**')
  505. elseif pvD2 <= 0.001
  506. text(mean(xt(3:4))-0.15, line1+0.5, '***')
  507. else
  508. text(mean(xt(3:4))-0.05, line1+0.75, 'ns','FontSize',8)
  509. end