figS6I.m 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. %% fig. S6I - Population response in Hit trial with/out anticipatory lick
  2. clear all
  3. close all
  4. % ==========================================================================
  5. %% Load data
  6. % ==========================================================================
  7. %Prepare variables
  8. load('figS6I.mat');
  9. % ===========================================
  10. %% Plot population response Hit Lick/Nonlick
  11. % ===========================================
  12. TimeWinFrame = [-5:1:60];
  13. fs = 30;
  14. fig1 = figure('Name','HitPopulation_LickNonLick');
  15. fig1.Position = [1200 200 550 280];
  16. for iLick = 1:2 %1 == Lick, 2 == NonLick
  17. for iPhase = 1:2 % 1 = Initial Expert, 2 = Reversal Expert
  18. meanResp = [];
  19. SEM = [];
  20. %iLick
  21. switch iLick
  22. case 1
  23. meanResp = MeanHitLick(:, :, iPhase); %Population x frame x (Initial or Reversal)
  24. SEM = SEMHitLick(:, :, iPhase); %1 x frame x (Initial or Reversal)
  25. Color = 'b';
  26. case 2
  27. meanResp = MeanHitNonLick(:, :, iPhase);%Population x frame x (Initial or Reversal)
  28. SEM = SEMHitNonLick(:, :, iPhase); %1 x frame x (Initial or Reversal)
  29. Color = 'k';
  30. end
  31. %Draw LinePlot------------------------------------------------------
  32. subplot(1, 2, iPhase);
  33. f1 = shadedErrorBar(TimeWinFrame/fs, meanResp, SEM, 'lineprops', Color); axis square;
  34. set([f1.edge], 'Visible', 'off')
  35. hold on
  36. %Adjust x axis-----------------------------------------------------
  37. hline(0, 'k');
  38. xlim([-0.15 2.0])
  39. xticks([0 2]);
  40. ylim([-0.15 0.15]);
  41. yticks([-0.1 0 0.1]);
  42. xlabel('Time from Stimulus (s)')
  43. %Add title---------------------------------------------------------
  44. switch iPhase
  45. case 1 %Initial Expert
  46. title('Initial-Expert')
  47. ylabel('zScore', 'FontSize', 10,'FontWeight','bold')
  48. if (iLick == 2)
  49. legend('Lick', 'NonLick', 'Location', 'northeast');
  50. legend ('boxoff')
  51. end
  52. case 2 %Reversal Expert
  53. title('Reversal-Expert')
  54. end%switch-iPhase
  55. end %for - iPhase
  56. end%for iLick
  57. suptitle('Population Response Hit - Lick vs NonLick')