12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- %% Fig. 2AB BarChart
- clear all
- close all
- % ==========================================================================
- %% k-means cluster barchart
- % ==========================================================================
- %Prepare variables
- load('Fig2AB_BarChart.mat');
- %Prepare variables
- NofMouse = 6;
- NofCluster = 6;
- catNames = {'Others', 'Stable1', 'Stable2', 'Up', 'Down', 'Ramp-up', 'Ramp-down'};
- %% Plot barchart
- for iLearning = 1:2
- CellRatio = [];
- switch iLearning
- case 1
- fig1 = figure;
- CellRatio = CellRatio4Cluster(:, :, 1);
- title('Proportion of cells for clusters - Go - Ini');
- hold on;
- case 2
- fig2 = figure;
- CellRatio = CellRatio4Cluster(:, :, 2);
- title('Proportion of cells for clusters - Go - Rev');
- hold on;
- end%iLearning
-
- Mean4Bar = mean(CellRatio,1);
- SEM4Bar = std(CellRatio,1)/sqrt(NofMouse);
-
- bar(1:size(catNames,2), Mean4Bar, 'FaceColor', 'none', 'EdgeColor', 'k');
- hold on;
- er = errorbar(1:size(catNames,2), Mean4Bar, SEM4Bar);
- er.Color = [0 0 0];
- er.LineStyle = 'none';
- er.MarkerEdgeColor = 'none';
- xticks([1 2 3 4 5 6 7]);
- xticklabels(catNames);
- box off
-
- ylim([0 0.55]);
- yticks([0 0.1 0.2 0.3 0.4 0.5]);
- ylabel('Proportion of cells')
-
- %Add scatter plot--------------------------------------------------------------------------
-
- if iLearning == 1 %First 4 mice are auditory reward group. The last 2 mice are visual reward group.
- Group1Color = [1 0 0];
- Group2Color = [0 1 0];
- disp('DotColor: Group1(Aud-1st) is Red, Group2(Vis-1st) is Green')
-
- elseif iLearning == 2 %First 4 mice are visual reward group. The last 2 mice are auditory reward group.
- Group1Color = [0 1 0];
- Group2Color = [1 0 0];
- disp('DotColor: Group1(Aud-1st) is Green, Group2(Vis-1st) is Red')
- end
-
- %Group1 - Aud-reward 1st
- Group1Cluster = [];
- Group1Cluster = CellRatio(1:4, :);
- sz = 20;
- ScatterID = repmat(1:NofCluster+1, size(Group1Cluster,1),1);
- scatter(ScatterID(:),Group1Cluster(:), [], Group1Color, 'filled','MarkerFaceAlpha',0.5','jitter','on','jitterAmount',0.15);
-
- %Group2 - Vis-reward 1st
- Group2Cluster = [];
- Group2Cluster = CellRatio(5:6, :);
- ScatterID = repmat(1:NofCluster+1, size(Group2Cluster,1),1);
- scatter(ScatterID(:),Group2Cluster(:), [], Group2Color, 'filled','MarkerFaceAlpha',0.5','jitter','on','jitterAmount',0.15);
-
- end %for iLearning
|