![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/281981/image.png)
Compare two data set with Bar Graph with ranges in xticks
17 ビュー (過去 30 日間)
古いコメントを表示
Ramesh Venkatasubramanian
2020 年 4 月 5 日
コメント済み: Ameer Hamza
2020 年 4 月 5 日
Hi guys, I am trying to compare two data sets using Bar Graph. I want to have bin ranges as xticks as shown in the attached images. Any help is much appreciated. Thanks.
0 件のコメント
採用された回答
Ameer Hamza
2020 年 4 月 5 日
編集済み: Ameer Hamza
2020 年 4 月 5 日
This show an example of what you are trying to do
bin_edges = 0:5:50;
locs = (bin_edges(1:end-1)+bin_edges(2:end))/2;
y1 = rand(1,10);
y2 = rand(1,10);
fig = figure();
ax = axes();
bar(locs, [y1;y2])
ax.XTick = locs;
ax.XTickLabel = compose('%d-%d', bin_edges(1:end-1)', bin_edges(2:end)');
ax.XTickLabelRotation = 90;
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/281981/image.png)
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Distribution Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!