123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- % plot deviance detection index to compare different contexts
- load('all_data.mat');
- pt=load('pt_data.mat'); pt=pt.all_di;
- class_=all_di(:,2)==0; % unit classification
- awake_=all_di(:,3)==0;
- anest_=all_di(:,3)==1;
- part1=logical(class_.*awake_);
- part2=logical(class_.*anest_);
- %% awake
- % context effect - navigation
- ce_expN=all_di(part1,10);
- ce_unexpN=all_di(part1,11);
- % context effect - communication
- ce_expC=all_di(part1,12);
- ce_unexpC=all_di(part1,13);
- % awake deviance detection index *(d.d)
- dd_N=(ce_unexpN-ce_expN)./2;
- dd_C=(ce_unexpC-ce_expC)./2;
- %% anesthetized
- ce_expN2=all_di(part2,10);
- ce_unexpN2=all_di(part2,11);
- % context effect - communication
- ce_expC2=all_di(part2,12);
- ce_unexpC2=all_di(part2,13);
- % add pure tones data set
- class_=pt(:,2)==0;
- int_=pt(:,3)==1; % intact sequences
- part3=logical(class_.*int_);
- % context effect - navigation
- ce_expN3=pt(part3,7);
- ce_unexpN3=pt(part3,8);
- % context effect - communication
- ce_expC3=pt(part3,9);
- ce_unexpC3=pt(part3,10);
- % merge two data set
- ce_expN4=[ce_expN2; ce_expN3];
- ce_unexpN4=[ce_unexpN2; ce_unexpN3];
- ce_expC4=[ce_expC2; ce_expC3];
- ce_unexpC4=[ce_unexpC2; ce_unexpC3];
- % anesthetized deviance detection index *(d.d)
- dd_N2=(ce_unexpN4-ce_expN4)./2;
- dd_C2=(ce_unexpC4-ce_expC4)./2;
- %% plotting scatter plot and histogram
- n_awake=numel(dd_N);
- n_anest=numel(dd_N2);
- names={repmat({'awake'},1,n_awake)'; repmat({'anestheitzed'},1,n_anest)'};
- names=cat(1, names{:});
- x=[dd_C; dd_C2];
- y=[dd_N; dd_N2];
- red =[0.8500,0.3250, 0.0980];
- blue=[0,0.4470,0.7410];
- close all;
- figure(1); set(gcf,'Position',[400 200 350 200])
- s=scatterhist(x,y,'Group',names,'Kernel','on','Direction','out',...
- 'LineWidth',[0.5,0.5],'Marker','o','MarkerSize',[1,1],...
- 'LineStyle','-','Color',[blue;red]);
- % current axes: scatter plot
- % xlim([-0.45 0.45])
- % ylim([-0.45 0.45])
- xline(0,'--','HandleVisibility','off');
- yline(0,'--','HandleVisibility','off');
- awake_com=s(2).Children(2).YData;
- awake_comX=s(2).Children(2).XData;
- anest_com=s(2).Children(3).YData;
- anest_comX=s(2).Children(3).XData;
- awake_nav=s(3).Children(2).YData;
- awake_navX=s(3).Children(2).XData;
- anest_nav=s(3).Children(3).YData;
- anest_navX=s(3).Children(3).XData;
- % in the current axes -> scatter
- hold on
- e=gscatter(x,y,names,[blue;red],'oo',3);
- jgroup = e(1);
- jgroup.MarkerEdgeColor='None' ;
- jgroup.MarkerFaceColor=[0.8 0.8 1];
- jgroup = e(2);
- jgroup.MarkerEdgeColor='None' ;
- jgroup.MarkerFaceColor=[1 0.5 0.5];
- e=gscatter(x,y,names,[blue;red],'oo',3);
- % change the current axes to s(2) -> xhist
- axes(s(2)); hold on
- xline(0,'--','HandleVisibility','off');
- px=[awake_comX, fliplr(awake_comX)];
- py=[zeros(numel(awake_com),1)', fliplr(awake_com)];
- fill(px,py,1,'FaceColor','r','EdgeColor','none'); hold on
- plot(awake_comX,awake_com,'LineWidth',0.5,'Color','k')
- alpha(0.1)
- px=[anest_comX, fliplr(anest_comX)];
- py=[zeros(numel(anest_com),1)', fliplr(anest_com)];
- fill(px,py,1,'FaceColor','b','EdgeColor','none'); hold on
- plot(anest_comX,anest_com,'LineWidth',0.5,'Color','k')
- alpha(0.1)
- % change the current axes to s(3) -> yhist
- axes(s(3))
- hold on ;
- xline(0,'--','HandleVisibility','off');
- px=[awake_navX, fliplr(awake_navX)];
- py=[zeros(numel(awake_nav),1)', fliplr(awake_nav)];
- fill(px,py,1,'FaceColor','r','EdgeColor','none'); hold on
- plot(awake_navX,awake_nav,'LineWidth',0.5,'Color','k')
- alpha(0.1)
- px=[anest_navX, fliplr(anest_navX)];
- py=[zeros(numel(anest_nav),1)', fliplr(anest_nav)];
- fill(px,py,1,'FaceColor','b','EdgeColor','none'); hold on
- plot(anest_navX,anest_nav,'LineWidth',0.5,'Color','k')
- alpha(0.1)
- axes(s(1))
- ax=gca;
- ax.YLabel.String = 's.s.s. echolocation';
- ax.XLabel.String = 's.s.s. communication';
- set(gca,'fontsize',8)
- set(gca,'linewidth',0.75);
|