%% sfig. 3CD_StackedBar % Plot stacked bar chart %% Code for sfig. 3cd_stackedbar chart %decimal point is cut off and adjusted TotalCell_Aud1st = [458; 413; 411; 388]; tempData4StackBar_Aud1st =... [280 111 46 21; 197 137 44 35; 231 27 123 30; 222 64 71 31]; TotalCell_Vist1st = [379; 342; 397; 321]; tempData4StackBar_Vis1st =... [206 25 121 27; 172 50 84 36; 234 92 41 30; 197 94 18 12]; Data4StackBar_Aud1st = nan(4,4); Data4StackBar_Vis1st = nan(4,4); for i=1:4 Data4StackBar_Aud1st(i,:) = tempData4StackBar_Aud1st(i,:)/TotalCell_Aud1st(i); Data4StackBar_Vis1st(i,:) = tempData4StackBar_Vis1st(i,:)/TotalCell_Vist1st(i); end for iModality=1:2 switch iModality case 1 figtitle = 'InitialLearning_GoNogoCellRatio_Aud1st'; Data4StackBar = Data4StackBar_Aud1st; case 2 figtitle = 'InitialLearning_GoNogoCellRatio_Vis1st'; Data4StackBar = Data4StackBar_Vis1st; end %Initial learning---------------------------------------------------------- fig1 = figure('Name', figtitle); fig1.Position = [410 278 160 220]; StackedBar = bar(Data4StackBar(1:2, :),'stacked', 'FaceColor','flat'); set(StackedBar,'EdgeColor', 'none'); 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', figtitle); fig2.Position = [710 278 160 220]; RevStack = bar(Data4StackBar(3:4, :),'stacked', 'FaceColor','flat'); set(RevStack,'EdgeColor', 'none'); 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 end%iModality disp('Stacked bar chart plot finished')