Error Bar lines are connected in bar plot

15 Ansichten (letzte 30 Tage)
Peter Smith
Peter Smith am 29 Okt. 2019
Beantwortet: Star Strider am 29 Okt. 2019
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'});
odd bar.PNG

Akzeptierte Antwort

Star Strider
Star Strider am 29 Okt. 2019

Weitere Antworten (0)

Kategorien

Mehr zu Discrete Data Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by