MATLAB Answers

arwa
0

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?

Asked by arwa
on 19 Dec 2016
Latest activity Answered by dpb
on 19 Dec 2016
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.

  0 Comments

Sign in to comment.

Tags

1 Answer

Answer by 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

  0 Comments

Sign in to comment.