A little missing of errorbar in loglog figure
1 view (last 30 days)
Show older comments
haibaraemily
on 1 Oct 2015
Commented: haibaraemily
on 2 Oct 2015
I don't know why the last errorbar missing and only shows a short rod.
PS: This happens after the code set(gca, 'YScale', 'log'), and before that code the errorbar is no problem in display.
Here is the code:
Area_ALL=80228972.3; radius_dark=[160.0 112.0 50.0 32.7 28.1 25.0 24.0 13.8 9.7 7.7 7.1 6.1 5.6 4.6 4.1 3.1 2.6 2.1 2.0 1.5]; freq_num=[1 2 3 4 5 6 7 8 10 11 12 14 15 16 17 18 21 22 23 24];
figure(1) sigma = sqrt(freq_num)/Area_ALL; h = errorbar(radius_dark,freq_num/Area_ALL,sigma); set(gca, 'XScale', 'log') set(gca, 'YScale', 'log')
Thank you for your time.
0 Comments
Accepted Answer
Walter Roberson
on 1 Oct 2015
The error bar at that point reaches below 0. log scale of negative values cannot be drawn.
Usually when plots such as this generate lines, the lines that are generated have only two coordinates, the beginning and the end. If either of those is 0 or negative then log scale cannot draw it and the point gets clipped out. But then there is only one coordinate for the line so it does not get drawn. MATLAB does not generate a bunch of line segments leading off to negative infinity hoping that some of them will be in view in order to draw from the upper point to the bottom of the axes -- after all, most of the time the yaxis limit is automatic according to the minimum and maximum data value, so where would you start the drawing from? 1e-308 and have the line plunge to -308 (log scale annotation) with all the useful data squished at the top? It could be done by a user option about where to start the drawing from, but that would make the plot routines more complicated.
More Answers (0)
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!