how to plot side by side bar chart on the same axis?
1 回表示 (過去 30 日間)
古いコメントを表示
I would like to have bar side by side for M1 on the left side of the figure and then likewise for M2 on the right side. M1 has 10 columns-so the plot be constructed in such a way that column 1 is aside with column 6 of M1. similarly, column 2 of M1 in comparison with column 7 of M1. I want the same for M2 but on the right side of the figure (i.e. there should be a gap between M1 and M2 dataset) see attached image as an example (i don't want bar stacked and have only two time periods correspond to M1 and M2). I tried the following but am not getting anywhere

M1 = -5 + (5+5)*rand(1,10);
M2= -5 + (5+5)*rand(1,10);
figure()
bar([M1(:,1:5);M1(:,6:10)])
hold on
yyaxis right
bar([M2(:,1:5);M2(:,6:10)])
1 件のコメント
James Knowles
2018 年 1 月 4 日
This in built function may be of some use https://au.mathworks.com/help/matlab/ref/subplot.html
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Histograms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!