Fig2C_BarChart.m 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. %% Fig. 2C - BarChart
  2. clear all
  3. close all
  4. % ==========================================================================
  5. %% k-mean cluster barchart - Expert - Expert
  6. % ==========================================================================
  7. %Prepare variables
  8. load('Fig2C_BarChart.mat');
  9. NofMouse = 6;
  10. catNames = {'Ohters', 'Stable', 'RampUp', 'RampDown', ...
  11. 'I-Up', 'R-Up', 'I-RampUp', 'I-RampDown', 'R-RampUp', 'R-RampDown'};
  12. % ===============================================================================
  13. %% Bar chart (mean)+ SEM - Proportion of cells from each mouse for each cluster
  14. % ===============================================================================
  15. fig1 = figure('Name', 'Proportion of cells for clusters -Go-Ex-Ex');
  16. fig1.Position = [680 558 1060 420];
  17. Mean = mean(CellRatio4Cluster,1);
  18. SEM = std(CellRatio4Cluster,1)/sqrt(NofMouse);
  19. bar(1:size(catNames,2), Mean, 'FaceColor', 'none', 'EdgeColor', 'k');
  20. hold on;
  21. er = errorbar(1:size(catNames,2), Mean, SEM);
  22. er.Color = [0 0 0];
  23. er.LineStyle = 'none';
  24. er.MarkerEdgeColor = 'none';
  25. xticks([1 2 3 4 5 6 7 8 9 10]);
  26. xticklabels(catNames);
  27. box off
  28. ylim([0 0.55]);
  29. yticks([0 0.1 0.2 0.3 0.4 0.5]);
  30. ylabel('Proportion of cells')
  31. %Add scatter plot--------------------------------------------------------------------------
  32. DotColor = [0.75 0.75 0.75];
  33. sz = 20;
  34. ScatterID = repmat(1:length(catNames), size(CellRatio4Cluster,1),1);
  35. scatter(ScatterID(:),CellRatio4Cluster(:), [], DotColor, 'filled','MarkerFaceAlpha',0.5','jitter','on','jitterAmount',0.15);