How can I draw two matrices in the same bar graph with same x-axis and y-axis, different colors for each matrix and with no overlapping?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi, I have two matrices (1x12) q and m as below: q = [0.5 1.2 1.1 0.3 0.2 0.8 0.5 0.7 1.0 1.4 0.6 0.7]; m = [0.2 1.7 1.3 0.1 2.3 4.0 0.9 3.4 1.5 0.5 0.2 3.4]; I draw these matrices with x-axis where x = [1 2 3 4 5 6 7 8 9 10 11 12] by the following code:
plotyy (x,q,x,m,'bar','bar')
I got this gragh..
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/159109/image.png)
but I would like to show the graph like this
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/159110/image.png)
How can I draw both matrices in the same bar graph with same x-axis and y-axis, with different colors for each matrix and with no overlapping like figure 2 ?
Thanks in advance.
댓글 수: 0
답변 (1개)
dpb
2016년 12월 19일
bar([m;q].')
for starters; see
doc bar % for details on how to set colors, bar spacing, etc., etc., ...
Per that doc, bar draws separate bar for each column of argument Y
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Two y-axis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!