How can I add errorbars to a log-log plot?

10 views (last 30 days)
alex tsamo
alex tsamo on 6 Aug 2018
Answered: dpb on 6 Aug 2018
I have tried the function errorbar but I could not plot at the log scale. This function work correctly but not in my case. The result I get is "Warning: Negative data ignored" and the resulting graph is attached below. The error bars should also decrease as x increases, something that is not happening. Can somebody help please? Either with a different function or the same one. Thank you in advance!

Answers (1)

dpb
dpb on 6 Aug 2018
Well, what is the log() of a negative value supposed to be?
You didn't show the values so we can't tell but clearly value-err is <0 for at least one point and that just can't be represented on a log axis. That's not the fault of the errorbar function and nothing can fix it other than changing the data.
As for visual appearance clearly the last two that are both positive are decreasing; they probably are numerically doing that for the others as well but error>value so value-error<0 as noted for the others.
Fix that and your problems will go away...

Community Treasure Hunt

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

Start Hunting!