need help for adding a error bar
古いコメントを表示
%------------------------------------------------------
M = [15, 0.765891, 30, 0.466818, 45, 0.770541
15, 0.3472, 30, 0.233845234, 45, 0.15337401
15, 0.15, 30, 0.261, 45, 0.344
15, 0.161, 30, 0.42, 45, 0.724];
b = bar(M(:,[2 4 6])');
set(gca, 'XTickLabel', string(M(1,[1 3 5])));
xlabel('%Carbon monoxide content');
ylabel('Mass gain (μg/mm^2)');
legend({['900' char(176) 'C'], ['800' char(176) 'C'], ['700' char(176) 'C'], ['600' char(176) 'C']});
%------------------------------------------------------
% add error bars
%
%------------------------------------------------------
hold on;
xx = [b(1).XEndPoints; b(2).XEndPoints; b(3).XEndPoints; b(4).XEndPoints];
yy = [b(1).YData; b(2).YData; b(3).YData; b(4).YData];
yneg = [0.51560 0.25806 0.12860 0.12847 0.28987 0.16209 0.12867 0.12913 0.29282 0.12890 0.12853 0.12920];%%%%%%%%%%
ypos = [0.77200 0.38820 0.19300 0.22494 0.61180 0.32200 0.20403 0.33897 0.55095 0.22610 0.19350 0.35329];%%%%%%%%%%
eb = errorbar(xx,yy,yneg,ypos'o', 'linestyle', 'none', 'color', 'k', 'linewidth', .8);
set(eb, 'HandleVisibility', 'off');
I would like to add a error bar to my graph. If you run a bar code you will get a 12 bar with 4 temperature and 3 different %carbon content,
I have a number from calulation on yneg (ErrorMin) ypos (ErrorMax),
I arange like first number from neg and pos are for first bar and continue.
and if you know how to do a pattern fill on a bar like a pircture below please help

採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Errorbars についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
