clear all; close all; format compact; % colors for two conditions ccol = [255 78 130; 40 130 255]/255; % define axes limits xlims = [0.5 2.5]; ylims = [-1 6]; % get two signals s1 = randn(50,1)+2; s2 = randn(50,1)+3; % bar graph figure, set(gcf,'Color', [1 1 1]) subplot(1,6,1), hold on set(gca,'FontSize',12) plot([0 3],[0 0],'-k') rectangle('Position',[0.7 0 0.8 mean(s1)],'FaceColor',ccol(1,:),'LineWidth',2) rectangle('Position',[1.5 0 0.8 mean(s2)],'FaceColor',ccol(2,:),'LineWidth',2) errorbar([1.1 1.9],[mean(s1) mean(s2)],[std(s1) std(s2)],'.k','LineWidth',2) xlim([0.5 2.5]) ylim([-1 6]) set(gca,'XTick',[1 2],'XTickLabel',{'C1' 'C2'}) ylabel('Amplitude (a.u.)') % box plot subplot(1,6,2), hold on set(gca,'FontSize',12) plot_vboxplot(s1,[0.7 1.3],ccol(1,:)) plot_vboxplot(s2,[1.7 2.3],ccol(2,:)) xlim(xlims) ylim(ylims) set(gca,'XTick',[1 2],'XTickLabel',{'C1' 'C2'}) % plot plot with individual data points subplot(1,6,3), hold on set(gca,'FontSize',12) plot_vboxplotPlus(s1,[0.6 1.4],[0 0 0; ccol(1,:); ccol(1,:)],0); plot_vboxplotPlus(s2,[1.6 2.4],[0 0 0; ccol(2,:); ccol(2,:)],1); xlim(xlims) ylim(ylims) set(gca,'XTick',[1 2],'XTickLabel',{'C1' 'C2'}) % histogram subplot(1,6,4), hold on set(gca,'FontSize',12) plot([0 0],ylims,':k') plot_indivHist(s1, ylims, 18, [1.5 0.08], ccol(1,:), -1) plot_indivHist(s2, ylims, 18, [1.5 0.08], ccol(2,:), 1) xlim(xlims) ylim(ylims) set(gca,'XTick',[1 2],'XTickLabel',{'C1' 'C2'}) % histogram with individual data points subplot(1,6,5), hold on set(gca,'FontSize',12) plot_indivHistDots(s1, ylims, 18, [1.5 0.08 20], ccol(1,:), -1) plot_indivHistDots(s2, ylims, 18, [1.5 0.08 20], ccol(2,:), 1) xlim(xlims) ylim(ylims) set(gca,'XTick',[1 2],'XTickLabel',{'C1' 'C2'}) % individual data points subplot(1,6,6), hold on set(gca,'FontSize',12) sp_handle = plotSpread([s1 s2],'xValues',[1 2],'distributionColors',{ccol(1,:) ccol(2,:)}); set(sp_handle{1},'MarkerSize',15); plot([0.7 1.3],[median(s1) median(s1)],'-k','LineWidth',2) plot([1.7 2.3],[median(s2) median(s2)],'-k','LineWidth',2) xlim(xlims) ylim(ylims) set(gca,'XTick',[1 2],'XTickLabel',{'C1' 'C2'})