필터 지우기
필터 지우기

Compare two data set with Bar Graph with ranges in xticks

조회 수: 17 (최근 30일)
Ramesh Venkatasubramanian
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.

채택된 답변

Ameer Hamza
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;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by