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 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
dpb
il 19 Dic 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 Commenti
Vedere anche
Categorie
Scopri di più su Two y-axis in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!