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?

3 views (last 30 days)
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..
but I would like to show the graph like this
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.

Answers (1)

dpb
dpb on 19 Dec 2016
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

Categories

Find more on Two y-axis in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!