12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- %% Fig. 1L - Stacked bar chart
- clear
- close all
- % ========================================
- %% Stacked bar
- % ========================================
- %Prepare variables
- TotalCell = [837; 755; 808; 709];
- tempData4StackBar =...
- [486 136 167 48;
- 369 187 128 71;
- 465 119 164 60;
- 419 158 89 43];
-
- Data4StackBar = nan(4,4);
- for i=1:4
- Data4StackBar(i,:) = tempData4StackBar(i,:)/TotalCell(i);
- end
- %Initial learning----------------------------------------------------------
- fig1 = figure('Name', 'InitialLearning_CellRatio');
- fig1.Position = [410 278 160 220];
- StackedBar = bar(Data4StackBar(1:2, :),'stacked', 'FaceColor','flat');
- set(StackedBar,'EdgeColor', 'none');
- title('Initial');
- xticklabels({'Initial', 'Reversal'});
- ylim([0 1.1]);
- StackedBar(1).CData = [0.85 0.85 0.85];
- StackedBar(2).CData = [1 0 0];
- StackedBar(3).CData = [0 0.85 0];
- StackedBar(4).CData = [0 0 1];
- box off
- lgd = legend('Non.Resp','Go','Nogo','Both');
- lgd.Location = 'SouthEast';
- lgd.Box = 'off';
- hold on
- %Reversal learning---------------------------------------------------------
- fig2 = figure('Name', 'ReversalLearning_CellRatio');
- fig2.Position = [710 278 160 220];
- RevStack = bar(Data4StackBar(3:4, :),'stacked', 'FaceColor','flat');
- set(RevStack,'EdgeColor', 'none');
- title('Reversal');
- xticklabels({'Initial', 'Reversal'});
- ylim([0 1.1]);
- RevStack(1).CData = [0.85 0.85 0.85];
- RevStack(2).CData = [1 0 0];
- RevStack(3).CData = [0 0.85 0];
- RevStack(4).CData = [0 0 1];
- box off
- Revlgd = legend('Non.Resp','Go','Nogo','Both');
- Revlgd.Location = 'SouthEast';
- Revlgd.Box = 'off';
- hold on
- disp('Stacked bar chart plot finished')
|