I want to have my error bar graph like given in picture

1 回表示 (過去 30 日間)
Muhammad Usman
Muhammad Usman 2015 年 7 月 9 日
clear all; clc;
C = [0.962 0.9416 0.9606 0.9845 0.9385];
N = [0.9392 0.979 0.948 0 0];
S = [0.9599 0.9276 0.9571 0.9339 0.9763];
xx = [C;N;S];
xx_error = xx/10;
h = bar(xx);
colormap(summer)
set(h,'BarWidth',0.8); % The bars will now touch each other
set(gca,'YGrid','on')
set(gca,'GridLineStyle','-')
set(gca,'XTicklabel','Cloudy|Night|Sunny')
set(get(gca,'YLabel'),'String','U')
lh = legend('Series1','Series2','Series3');
set(lh,'Location','BestOutside','Orientation','horizontal')
hold on;
numgroups = size(xx, 1);
numbars = size(xx, 2);
groupwidth = min(0.8, numbars/(numbars+1.5));
for i = 1:numbars
% Based on barweb.m by Bolu Ajiboye from MATLAB File Exchange
x = (1:numgroups) - groupwidth/2 + (2*i-1) * groupwidth / (2*numbars); % Aligning error bar with individual bar
errorbar(x, xx(:,i), xx_error(:,i), 'k', 'linestyle', 'none');
end

回答 (0 件)

カテゴリ

Help Center および File ExchangeErrorbars についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by