How can I create a horizontal bar plot and label in each stack
조회 수: 12 (최근 30일)
이전 댓글 표시
I have ahorizontal two stacked bar plots, for the data shown below.
i want to label on the stacks & to ajdust the thickness of the bar
Note: the figure i want to produce is shown on figure 1 (produced by excel), but MATLAB produces the one shown on figure 2. I could'nt figure out how this is working.
Need your smart ideas
best
a1=[51.2 1.6 8.7 9.9 1.1 26.0 1.5 0.0
25.5 0.0 0.3 7.9 0.0 58.6 5.4 2.3];
barh(a1,'stacked')
legend('1','2','3','4','5','6','7','8')
set(gca,'yticklabel',{'1996','2017'})
댓글 수: 0
채택된 답변
VBBV
2020년 11월 24일
%if
width=0.1
barh(a1,width,'stacked')
legend('1','2','3','4','5','6','7','8')
To add labels on bar sections read the Add labels to bars section in this resource
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Legend에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!