figS6AB.m 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. %% fig. S6AB - Proportion of correlated cells
  2. % Load necessary data for fig.S4A
  3. clear all
  4. close all
  5. % =========================================================================
  6. %% Load data
  7. % =========================================================================
  8. %Prepare variables
  9. %load('figS6A.mat'); %For locomotion
  10. load('figS6B.mat'); %For pupil
  11. %SigCorrCell
  12. %Row 1 = Stimulus
  13. %Row 2 = Delay
  14. %Row 3 = ITI
  15. % =========================================================================
  16. %% Bar plot of the proportion of correlated cells
  17. % =========================================================================
  18. NofCell = 210;
  19. for iTaskWindow = 1:3
  20. % 1: Stimulus
  21. % 2: Delay
  22. % 3: ITI
  23. switch iTaskWindow
  24. case 1
  25. FigtTitle = 'Stimulus period';
  26. case 2
  27. FigtTitle = 'Delay period';
  28. case 3
  29. FigtTitle = 'ITI period';
  30. end
  31. Data4StackBar_SigCorrCell = [];
  32. for iPhase = 1:4
  33. Data4StackBar_SigCorrCell(iPhase, :) = ...
  34. [NofCell-SigCorrCell(iTaskWindow, iPhase) SigCorrCell(iTaskWindow, iPhase)]/NofCell;
  35. end
  36. fig = figure('Name', FigtTitle);
  37. fig.Position = [410 278 500 220];
  38. for iPhase = [1 3]
  39. switch iPhase
  40. case 1
  41. Figtitle_Inside = 'Initial - SigCorrCell';
  42. PlotPos = 1;
  43. case 3
  44. Figtitle_Inside = 'Reversal - SigCorrCell';
  45. PlotPos = 2;
  46. end
  47. subplot(1,2, PlotPos)
  48. StackedBar = bar(Data4StackBar_SigCorrCell(iPhase:iPhase+1, :),'stacked', 'FaceColor', 'flat');
  49. set(StackedBar,'EdgeColor', 'none');
  50. ylim([0 1.1]);
  51. StackedBar(1).CData = [0.85 0.85 0.85]; %Non-sig
  52. StackedBar(2).CData = [1 0.85 0.85]; %Sig corr
  53. box off
  54. lgd = legend('Non.Sig','Sig.');
  55. lgd.Location = 'SouthEast';
  56. lgd.Box = 'off';
  57. title(Figtitle_Inside);
  58. end %iPhase
  59. end