Fig1G.m 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. %% Code for Fig. 1G, d-prime around learning threshold
  2. clear
  3. close all
  4. % ====================================================================================================
  5. %% Plot d-prime, Mean +/- SEM (-3 session with d'<1.5 to 3 sessions with d'> 1.5 )
  6. % ====================================================================================================
  7. overlay = figure('Name', 'd-prime_AroundCriterion');
  8. overlay.Position = [100 100 270 350];
  9. NofMouse = 8;
  10. %Plot dprime Initial-------------------------------------------------------
  11. dprime_Initial = ...
  12. [-0.401 -0.588 1.290 3.162 3.895 3.805
  13. 1.224 1.633 1.848 2.599 2.363 2.311
  14. 0.445 0.215 0.516 1.664 2.654 1.975
  15. -0.588 0.931 1.193 2.682 2.440 2.388
  16. NaN -0.018 1.396 1.696 2.826 3.590
  17. 0.398 0.625 0.728 1.664 1.853 2.414
  18. -0.309 -0.588 1.097 2.286 2.392 3.095
  19. 0.519 0.215 1.396 2.626 3.423 3.590];
  20. x = 1:size(dprime_Initial,2);
  21. TaskTypeColor = [0 0.45 0.74];
  22. meanResp = [];
  23. SEM = [];
  24. meanResp = nanmean(dprime_Initial(:,:),1);
  25. SEM = nanstd(dprime_Initial(:,:),0,1)/sqrt(NofMouse);
  26. %N of data point is adjusted by NaN
  27. SEM(1) = nanstd(dprime_Initial(:,1),0,1)/sqrt(NofMouse-1);
  28. h1 = errorbar(x, meanResp, SEM, '-o', 'color', TaskTypeColor, 'MarkerFaceColor', TaskTypeColor);
  29. h1.LineWidth = 1.0;
  30. hold on;
  31. box off
  32. ax = gca;
  33. ax.FontSize = 12;
  34. %Plot dprime Reversal------------------------------------------------------
  35. dprime_Reversal = ...
  36. [NaN -0.767 -0.338 1.548 2.599 2.183
  37. 0.388 -0.736 0.866 2.260 3.162 3.374
  38. 0.371 0.758 1.103 2.492 2.767 NaN
  39. 1.782 2.293 1.079 1.975 2.388 3.374
  40. 0.388 -0.338 1.046 2.517 3.201 2.882
  41. -0.059 0.119 1.117 1.948 1.972 2.608
  42. 0.818 1.385 0.974 2.260 2.599 2.626
  43. -0.340 1.320 1.046 2.337 2.327 2.671];
  44. x = 1:size(dprime_Reversal,2);
  45. TaskTypeColor = [0.85 0.33 0.10];
  46. meanResp_Rev = [];
  47. SEM_Rev = [];
  48. meanResp_Rev = nanmean(dprime_Reversal(:,:),1);
  49. SEM_Rev = nanstd(dprime_Reversal(:,:),0,1)/sqrt(NofMouse);
  50. SEM_Rev(1) = nanstd(dprime_Reversal(:,1),0,1)/sqrt(NofMouse-1);
  51. SEM_Rev(6) = nanstd(dprime_Reversal(:,6),0,1)/sqrt(NofMouse-1);
  52. h2 = errorbar (x, meanResp_Rev, SEM_Rev, '-o', 'color', TaskTypeColor, 'MarkerFaceColor', TaskTypeColor);
  53. h2.LineWidth = 1;
  54. hold on;
  55. box off
  56. %Plot line along d'=1.5. This is learning threshold
  57. hline(1.5);
  58. %lim, ticks, labels
  59. xlim([0.5 6.5]);
  60. ylim ([-0.5 3.5]);
  61. NofXticks = 1:1:6;
  62. xticks(NofXticks);
  63. xticklabels({'-3', '-2', '-1', '1', '2', '3'})
  64. yticks([-1.0 0 1.0 2.0 3.0 4.0]);
  65. xlabel('Session')
  66. ylabel('d-prime')
  67. ax = gca;
  68. ax.FontSize = 12;
  69. %legend
  70. led = legend('Initial', 'Reversal', 'Location', 'Southeast');
  71. legend box off
  72. %title
  73. title('d-prime transition','FontSize', 15)