% fake some data x_data = 0:2*pi/10:2*pi; sym_data = sin(repmat(x_data, 10,1)) * 0.75 + (randn(10, length(x_data)) .* cos(repmat(x_data, 10,1))); asym_data = sin(repmat(x_data, 10,1)) * 0.75 + (randn(10, length(x_data)) .* cos(repmat(x_data, 10,1)) + 0.5); % get some data characteristics avg_sym = mean(sym_data, 1); err_sym = std(sym_data, [], 1); avg_asym = median(asym_data, 1); err_upper_asym = prctile(asym_data, 75, 1); err_lower_asym = prctile(asym_data, 25, 1); fig = figure(); fig.PaperUnits = 'centimeters'; fig.PaperSize = [15 6.5]; fig.PaperPosition = [0.0 0.0 15, 6.5]; fig.Color = 'white'; subplot(1,3,1) errorbar(x_data, avg_sym, err_sym, 'marker', 'o') xlim([-.5, 6.5]) xlabel('x-data') ylabel('y-data') box('off') subplot(1,3,2) errorbar(x_data, avg_asym, err_lower_asym, err_upper_asym, 'marker', 'o') xlim([-.5, 6.5]) yticklabels([]) xlabel('x-data') box('off') subplot(1,3,3) hold on p = fill(cat(2, x_data, fliplr(x_data)), ... cat(2, avg_sym - err_sym, fliplr(avg_sym + err_sym)), ... 'b'); p.FaceAlpha = 0.125; p.EdgeColor = 'w'; xlim([-.5, 6.5]) yticklabels([]) box('off') xlabel('x-data') plot(x_data, avg_sym, 'b', 'linewidth', 1.) saveas(fig, '../lecture/images/errorbars', 'pdf')