필터 지우기
필터 지우기

Bar graphed 'stack' option

조회 수: 3 (최근 30일)
nor
nor 2012년 4월 10일
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.

답변 (2개)

Sean de Wolski
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')

nor
nor 2012년 4월 10일
Sorry to bother everyone. I have actually figures it out. The way the stacked bar is display is actually quite confusing.

카테고리

Help CenterFile Exchange에서 Bar Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by