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

2 visualizaciones (últimos 30 días)
Muhammad Usman
Muhammad Usman el 9 de Jul. de 2015
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

Respuestas (0)

Categorías

Más información sobre Errorbars en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by