Negatives values are ignored. Why?

Dear all, I am plotting few values that go from close to 0 to something large, so I want to the y axis to become in log scale.
boxplot(A','symbol','','extrememode','compress','labels',[1 2 3 4 5 6 7],'whisker',0); set(gca,'YScale','log') ; Warning: Negative data ignored
which I can understand as >> min(min(A))
ans =
0.0015
>> log(min(min(A)))
ans =
-6.4852
what do you think from your experience I should do for that? B.R Alex

답변 (1개)

Daniel Shub
Daniel Shub 2011년 8월 18일

0 개 추천

If I understand boxplot correctly, it is not just plotting A, but it is also plotting errorbars and boxes. It is possible that the errorbars/boxes/whiskers become negative. I do not think this can happen with whisker 0 option. It might be that extrememode compress causes some of your data to become negative.

댓글 수: 3

Oleg Komarov
Oleg Komarov 2011년 8월 18일
h = boxplot(rand(100,1)) causes the same problem and it just how data is visualized.
get(h(4),'Ydata') will be positive but to draw properly the last whicsker the axis Y limit is set slightly negative.
Alex
Alex 2011년 8월 19일
I tried even this
ylim([-100 100]);
>> set(gca,'YScale','log');
Warning: Negative data ignored
which makes all the boxplots centered and pretty tine
I keep even getting the same warning...
Oleg Komarov
Oleg Komarov 2011년 8월 19일
The natural log's domain is R^plus, i.e. > 0, and log(0) is -inf. You can't supply negative values to log.
http://en.wikipedia.org/wiki/Natural_logarithm

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Two y-axis에 대해 자세히 알아보기

질문:

2011년 8월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by