Error Bar lines are connected in bar plot
조회 수: 4 (최근 30일)
이전 댓글 표시
For some reason, lines are connecting my mean values when I add error bars to a bar plot.... any idea how to fix this?
Here's my code:
sens_top = sens_top(~isnan(sens_top));
spec_top = spec_top(~isnan(spec_top));
sens_bottom = sens_bottom(~isnan(sens_bottom));
spec_bottom = spec_bottom(~isnan(spec_bottom));
data(1) = mean(sens_top);
data(2) = mean(spec_top);
data(3) = mean(sens_bottom);
data(4) = mean(spec_bottom);
errhigh(1) = prctile(sens_top, 75);
errhigh(2) = prctile(spec_top, 75);
errhigh(3) = prctile(sens_bottom, 75);
errhigh(4) = prctile(spec_bottom, 75);
errlow(1) = prctile(sens_top, 25);
errlow(2) = prctile(spec_top, 25);
errlow(3) = prctile(sens_bottom, 25);
errlow(4) = prctile(spec_bottom, 25);
x = 1:4;
figure
bar(x, data)
hold on
er = errorbar(x, data, errlow, errhigh);
er.Color = [0 0 0];
er.LineStyle = 'none';
set(gca,'xticklabel',{'Worst Feat. Sensitivity', 'Worst Feat. Specificity',...
'Best Feat. Sensitivity', 'Best Feat. Specificity'});

댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Discrete Data Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!