Stacked bar plot not working correctly
조회 수: 7 (최근 30일)
이전 댓글 표시
x = [1980 1990 2000];
y = [15 20 -5; 10 -17 21; -10 5 15];
bar(x,y,'stacked')
In the documentation page they display this plot:
![BarStackWithNegativeValuesExample_01.png](https://ch.mathworks.com/help/examples/graphics/win64/BarStackWithNegativeValuesExample_01.png)
When I type the same code i get this one:
![FailedPlot.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/245654/FailedPlot.png)
I am using Matlab R2018b. Is this a bug in the release version or is it just me?
댓글 수: 0
답변 (2개)
Sushant Varghese
2020년 1월 30일
편집: Sushant Varghese
2020년 1월 30일
It's a bug. Although not ideal, I used this as a work around.
t1 = X;
t2 = X;
t1(t1<0) = 0;
t2(t2>0) = 0;
subplot(2,1,1)
bar(t1,'stacked');
subplot(2,1,2)
bar(t2,'stacked');
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!