Bar graphed 'stack' option
1 回表示 (過去 30 日間)
古いコメントを表示
Hi, I have a problem when plotting a bar graph using the 'stack' option. The stacked bar graph I get do not give the right sum of the elements in the matrix when the elements are of negative values. I attached a simple matrix here A=[8 -1 -4 -2 3; 2 -5 -1 -2 -7]
The summation of the first row= 4 The summation of the second row= -13 The command >>bar(A,'stack) does not display the right summation. Can anyone please explain why is that so?
Thank you in advance.
0 件のコメント
回答 (2 件)
Sean de Wolski
2012 年 4 月 10 日
If you want to see the sum, then you'll need to feed the sum of A into bar()
bar(sum(A,2),'stacked')
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Discrete Data Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!