% Make a bar chart results = [ 5, 3, 2, 6]; sterrors = [0.5, 0.2, 0.1, 0.8]; % there's often a one-line command that does most of what you want ... bar(results); clf; % ... but getting the figure exactly right takes a bit more work xvals = [1,2,4,5]; xtick = [1.5, 4.5]; xlabels = {'Factor A1', 'Factor A2'}; legendlabels = {'Factor B1', 'Factor B2'}; bfactors = [1,2,1,2]; barcolors = {'b', 'r'}; hold on for i = 1:length(results) h(i) = bar(xvals(i), results(i)); set(h(i), 'facecolor', barcolors{bfactors(i)}); he(i) = errorbar(xvals(i), results(i), sterrors(i), barcolors{bfactors(i)}); end results = [ 5, 3, 2, 6]; sterrors = [0.5, 0.2, 0.1, 0.8] set(gca, 'xtick', xtick); set(gca, 'xticklabel', xlabels); % add a legend legend(h(1:2), legendlabels, 'location', 'northeastoutside'); % label y axis ylabel('score');