[plotting] add code and figure to creta errorbar plots
This commit is contained in:
parent
f4716d8ea7
commit
12971932c5
43
plotting/code/errorbarplot.m
Normal file
43
plotting/code/errorbarplot.m
Normal file
@ -0,0 +1,43 @@
|
||||
% 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();
|
||||
set(fig, 'paperunits', 'centimeters', 'papersize', [15 6.5], ...
|
||||
'paperposition', [0.0 0.0 15, 6.5], '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')
|
BIN
plotting/lecture/images/errorbars.pdf
Normal file
BIN
plotting/lecture/images/errorbars.pdf
Normal file
Binary file not shown.
Reference in New Issue
Block a user