Something is not right with bar plot when some values are very very high and it is required to limit y values so that other values can be seen.
highValue=10E15;
y = [2 2 3*highValue; 2 5 6*highValue; 2 8 9*highValue; 2 11 12*highValue];
bar(y)
Now I want to limit yvalue so that I can see other values
ylim([0 10])
Now the results is:
No issue when highValue=10E14. Is this a bug in bar plot?

댓글 수: 4

dpb
dpb 2020년 4월 22일
Duplicated here w/ R2019b. Which release are you using?
Does look like something went wrong in rendering, agreed.
Durga Lal Shrestha
Durga Lal Shrestha 2020년 4월 22일
I tested with 2019a, 2019b and 2020a, the issue persistent with all these versions.
dpb
dpb 2020년 4월 22일
R2014b doesn't go outside the box boundaries but generates the same diagonal slash on the second group...
Adam Danz
Adam Danz 2020년 4월 22일
편집: Adam Danz 2020년 4월 22일
Error reproduced in r2020a.

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

답변 (1개)

Muhammad Usman
Muhammad Usman 2020년 4월 22일

0 개 추천

I suggest you to use two additional lines of code
highValue=10E15;
y = [2 2 3*highValue; 2 5 6*highValue; 2 8 9*highValue; 2 11 12*highValue];
bar(y)
set(gca,'YScale','log');
grid on;

댓글 수: 4

dpb
dpb 2020년 4월 22일
Nice workaround to get around the display problem...
Durga Lal Shrestha
Durga Lal Shrestha 2020년 4월 22일
Thanks for the suggestion. But my data has also negative values, so log scale does not work.
Durga Lal Shrestha
Durga Lal Shrestha 2020년 4월 22일
I found this type of issue with plot function as well.
dpb
dpb 2020년 4월 23일
Is there really some mandatory reason to have such a large highvalue value, anyway, in reality?
Doesn't seem realistic use case, somehow...

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

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

태그

질문:

2020년 4월 22일

댓글:

dpb
2020년 4월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by