Fig1B.m 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. % plot one neuron activity to make explanatory diagram
  2. load('all_psth.mat');
  3. bins=0.002;
  4. load('stim_onsetFSv2.mat');
  5. stim_onset=stim_onset/192000;
  6. unit_to_plot=55;
  7. state=3; % awake
  8. c1=psths(:,1)==state;
  9. c2=psths(:,2)==unit_to_plot;
  10. nav_iso=psths(:,3)==1; % echolocation isolated
  11. com_iso=psths(:,3)==2; % communication isolated
  12. nav_unexp=psths(:,3)==3; % unexpected navigation context
  13. nav_exp=psths(:,3)==4; % expected navigation context
  14. com_unexp=psths(:,3)==5; % unexpected communication context
  15. com_exp=psths(:,3)==6; % expected communication context
  16. % plotting
  17. figure(1); set(gcf,'Position',[200 200 250 90])
  18. t=tiledlayout(1,2);
  19. % no context
  20. ax1 = nexttile;
  21. % plot echolocation
  22. y=psths(logical(c1.*c2.*nav_iso),4:end);
  23. x=bins*(0:size(y,2)-1);
  24. w = gausswin(20);
  25. y = filter(w,1,y);
  26. plot(x,y,'b','LineWidth',1.5); hold on
  27. % plot communication
  28. y=psths(logical(c1.*c2.*com_iso),4:end);
  29. x=bins*(0:size(y,2)-1);
  30. y = filter(w,1,y);
  31. plot(x,y,'r','LineWidth',1.5)
  32. % plotting format
  33. xlim([3.5 3.7])
  34. % ylim([-1 6])
  35. xline(stim_onset(2),'Color','k','LineWidth',1,'LineStyle',':')
  36. set(gca, 'box', 'off')
  37. set(gca, 'Color','none')
  38. set(gca,'linewidth',1);set(gca,'fontsize',8);
  39. set(gca,'xtick',[])
  40. set(gca,'ytick',[])
  41. % echolocation context
  42. ax2 = nexttile;
  43. % plot echolocation
  44. y=psths(logical(c1.*c2.*nav_exp),4:end);
  45. x=bins*(0:size(y,2)-1);
  46. w = gausswin(20);
  47. y = filter(w,1,y);
  48. plot(x,y,'b','LineWidth',1.5); hold on
  49. % plot communication
  50. y=psths(logical(c1.*c2.*nav_unexp),4:end);
  51. x=bins*(0:size(y,2)-1);
  52. y = filter(w,1,y);
  53. plot(x,y,'r','LineWidth',1.5)
  54. % plotting format
  55. xlim([1.54 1.74])
  56. ylim([-1 6])
  57. xline(stim_onset(4),'Color','k','LineWidth',1,'LineStyle',':')
  58. set(gca, 'box', 'off')
  59. set(gca, 'Color','none')
  60. set(gca,'linewidth',1);set(gca,'fontsize',8);
  61. set(gca,'xtick',[])
  62. set(gca,'ytick',[])