How to plot errorbar with only upper error bars?
11 views (last 30 days)
Show older comments
Guy Doron
on 14 Sep 2011
Commented: Wolfgang Klassen
on 2 Oct 2019
I am trying to plot error bars using the errorbar function. When using the errorbar(X,Y,L,U) and providing L with NaNs and U with the requested values it does not show the error bar line (just upper limit short line). I will appreciate any advice or function which allows plotting only upper error bar lines
Thanx in advance
Guy
0 Comments
Accepted Answer
Daniel Shub
on 14 Sep 2011
The simplest way might be to do:
errorbar(X,Y,zeros(size(Y)),U)
you could also hack the code to not plot the lower bar at all
edit errorbar
0 Comments
More Answers (1)
Örs Szalontai
on 13 Dec 2016
Edited: Örs Szalontai
on 13 Dec 2016
Dear Everyone!
I am a really amateur user of MATlab, however, I still didn't understand (after hours) how the L and U values are calculated! Can someone explain why 'errorbar(X,Y,L,U)("which are the same lengths as the others) as previously described https://www.mathworks.com/matlabcentral/answers/15842-how-to-plot-errorbar-with-only-upper-error-bars here why does not work? I cannot imagine where from matlab generates these L and U values and why them are misplaced in plotting(which were perfectly working when I used 'errorbar(Y,E)'? How can I generate the exact L and U coordinates to place the only UPPER error bars? Anything! Thanks!
All yours, an amateur!
1 Comment
Wolfgang Klassen
on 2 Oct 2019
This is a super late reply to an old topic, but here goes.
'L' and 'U' are not calculated by Matlab, they are user provided. When you use 'errorbar(Y,E)' you are telling Matlab to plot values Y, and also plot a bar going up from Y an amount E and a bar going down from Y an amount E. E represents how far above and below the data the error bars go.
If you want to have the bars going up be larger than the bars going down, you use 'errorbar(X,Y,L,U)' to specify an error bar going up from Y by an amount U, and going down from Y an amount L. Having no lower error bars is a special instance of this, where you provide a list of zeroes as L.
See Also
Categories
Find more on Errorbars in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!