Fig6A.m 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. % plot deviance detection index to compare different contexts
  2. load('all_data.mat');
  3. pt=load('pt_data.mat'); pt=pt.all_di;
  4. class_=all_di(:,2)==0; % unit classification
  5. awake_=all_di(:,3)==0;
  6. anest_=all_di(:,3)==1;
  7. part1=logical(class_.*awake_);
  8. part2=logical(class_.*anest_);
  9. %% awake
  10. % context effect - navigation
  11. ce_expN=all_di(part1,10);
  12. ce_unexpN=all_di(part1,11);
  13. % context effect - communication
  14. ce_expC=all_di(part1,12);
  15. ce_unexpC=all_di(part1,13);
  16. % awake deviance detection index *(d.d)
  17. dd_N=(ce_unexpN-ce_expN)./2;
  18. dd_C=(ce_unexpC-ce_expC)./2;
  19. %% anesthetized
  20. ce_expN2=all_di(part2,10);
  21. ce_unexpN2=all_di(part2,11);
  22. % context effect - communication
  23. ce_expC2=all_di(part2,12);
  24. ce_unexpC2=all_di(part2,13);
  25. % add pure tones data set
  26. class_=pt(:,2)==0;
  27. int_=pt(:,3)==1; % intact sequences
  28. part3=logical(class_.*int_);
  29. % context effect - navigation
  30. ce_expN3=pt(part3,7);
  31. ce_unexpN3=pt(part3,8);
  32. % context effect - communication
  33. ce_expC3=pt(part3,9);
  34. ce_unexpC3=pt(part3,10);
  35. % merge two data set
  36. ce_expN4=[ce_expN2; ce_expN3];
  37. ce_unexpN4=[ce_unexpN2; ce_unexpN3];
  38. ce_expC4=[ce_expC2; ce_expC3];
  39. ce_unexpC4=[ce_unexpC2; ce_unexpC3];
  40. % anesthetized deviance detection index *(d.d)
  41. dd_N2=(ce_unexpN4-ce_expN4)./2;
  42. dd_C2=(ce_unexpC4-ce_expC4)./2;
  43. %% plotting scatter plot and histogram
  44. n_awake=numel(dd_N);
  45. n_anest=numel(dd_N2);
  46. names={repmat({'awake'},1,n_awake)'; repmat({'anestheitzed'},1,n_anest)'};
  47. names=cat(1, names{:});
  48. x=[dd_C; dd_C2];
  49. y=[dd_N; dd_N2];
  50. red =[0.8500,0.3250, 0.0980];
  51. blue=[0,0.4470,0.7410];
  52. close all;
  53. figure(1); set(gcf,'Position',[400 200 350 200])
  54. s=scatterhist(x,y,'Group',names,'Kernel','on','Direction','out',...
  55. 'LineWidth',[0.5,0.5],'Marker','o','MarkerSize',[1,1],...
  56. 'LineStyle','-','Color',[blue;red]);
  57. % current axes: scatter plot
  58. % xlim([-0.45 0.45])
  59. % ylim([-0.45 0.45])
  60. xline(0,'--','HandleVisibility','off');
  61. yline(0,'--','HandleVisibility','off');
  62. awake_com=s(2).Children(2).YData;
  63. awake_comX=s(2).Children(2).XData;
  64. anest_com=s(2).Children(3).YData;
  65. anest_comX=s(2).Children(3).XData;
  66. awake_nav=s(3).Children(2).YData;
  67. awake_navX=s(3).Children(2).XData;
  68. anest_nav=s(3).Children(3).YData;
  69. anest_navX=s(3).Children(3).XData;
  70. % in the current axes -> scatter
  71. hold on
  72. e=gscatter(x,y,names,[blue;red],'oo',3);
  73. jgroup = e(1);
  74. jgroup.MarkerEdgeColor='None' ;
  75. jgroup.MarkerFaceColor=[0.8 0.8 1];
  76. jgroup = e(2);
  77. jgroup.MarkerEdgeColor='None' ;
  78. jgroup.MarkerFaceColor=[1 0.5 0.5];
  79. e=gscatter(x,y,names,[blue;red],'oo',3);
  80. % change the current axes to s(2) -> xhist
  81. axes(s(2)); hold on
  82. xline(0,'--','HandleVisibility','off');
  83. px=[awake_comX, fliplr(awake_comX)];
  84. py=[zeros(numel(awake_com),1)', fliplr(awake_com)];
  85. fill(px,py,1,'FaceColor','r','EdgeColor','none'); hold on
  86. plot(awake_comX,awake_com,'LineWidth',0.5,'Color','k')
  87. alpha(0.1)
  88. px=[anest_comX, fliplr(anest_comX)];
  89. py=[zeros(numel(anest_com),1)', fliplr(anest_com)];
  90. fill(px,py,1,'FaceColor','b','EdgeColor','none'); hold on
  91. plot(anest_comX,anest_com,'LineWidth',0.5,'Color','k')
  92. alpha(0.1)
  93. % change the current axes to s(3) -> yhist
  94. axes(s(3))
  95. hold on ;
  96. xline(0,'--','HandleVisibility','off');
  97. px=[awake_navX, fliplr(awake_navX)];
  98. py=[zeros(numel(awake_nav),1)', fliplr(awake_nav)];
  99. fill(px,py,1,'FaceColor','r','EdgeColor','none'); hold on
  100. plot(awake_navX,awake_nav,'LineWidth',0.5,'Color','k')
  101. alpha(0.1)
  102. px=[anest_navX, fliplr(anest_navX)];
  103. py=[zeros(numel(anest_nav),1)', fliplr(anest_nav)];
  104. fill(px,py,1,'FaceColor','b','EdgeColor','none'); hold on
  105. plot(anest_navX,anest_nav,'LineWidth',0.5,'Color','k')
  106. alpha(0.1)
  107. axes(s(1))
  108. ax=gca;
  109. ax.YLabel.String = 's.s.s. echolocation';
  110. ax.XLabel.String = 's.s.s. communication';
  111. set(gca,'fontsize',8)
  112. set(gca,'linewidth',0.75);