![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/196666/image.jpeg)
Bar plot with error bar
16 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sourangsu Chowdhury
am 26 Sep. 2018
Beantwortet: Adam Danz
am 26 Sep. 2018
I have to plot bar plots with error bars but the error bars. For example
A 10(4-18)
B 21(11-28)
C 32(19-37)
A, B and C are to be plotted as bars with the center value (not in parenthesis). The values in parenthesis are the lower and upper limits of the whiskers to be represented as errors on the bar plot. Thank You
0 Kommentare
Akzeptierte Antwort
Adam Danz
am 26 Sep. 2018
Here's a demo using your data.
count = [10, 21, 32];
errLim = [4, 11, 19; 18, 28, 37];
err = errLim - count;
figure;
bar(count)
hold on
errorbar(1:length(count), [10, 21, 32], err(1,:), err(2,:), 'LineStyle','none')
set(gca, 'xtick', 1:length(count), 'xticklabel', {'A' 'B' 'C'})
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/196666/image.jpeg)
0 Kommentare
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Line 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!