Stacked bar plot not working correctly

16 ビュー (過去 30 日間)
Jose Aguilar
Jose Aguilar 2019 年 10 月 30 日
編集済み: Sushant Varghese 2020 年 1 月 30 日
I am trying to plot the stacked bar plot with negative values from the documentation page:
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
When I type the same code i get this one:
FailedPlot.png
I am using Matlab R2018b. Is this a bug in the release version or is it just me?

回答 (2 件)

Roshni Garnayak
Roshni Garnayak 2019 年 11 月 10 日
It was a bug. The issue has been resolved in MATLAB R2019b.

Sushant Varghese
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');

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by