Stacked bar plot not working correctly
5 次查看(过去 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:
When I type the same code i get this one:
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!