필터 지우기
필터 지우기

How do I make bar graph spacing equal?

조회 수: 8 (최근 30일)
AAK
AAK 2021년 5월 29일
댓글: Star Strider 2021년 5월 29일
Y = [2021 2021 2021 2021 2021] ;
M = [02 02 02 02 03] ;
D = [09 17 22 24 02];
x = datetime(Y,M,D) ;
y = [2.1 9 9.9 12.4 5] ;
figure
bar(x,y)
set(gca,'FontSize',8.5)
ylabel('Temperature (degrees Celsius)')
xlabel('Date')
axis tight
I have temperature on the y axis and dates on the x axis but the spacing is uneven. How do I make the spacing equal?
Thanks :)

채택된 답변

Star Strider
Star Strider 2021년 5월 29일
One approach —
Y = [2021 2021 2021 2021 2021] ;
M = [02 02 02 02 03] ;
D = [09 17 22 24 02];
x = datetime(Y,M,D);
y = [2.1 9 9.9 12.4 5] ;
figure
bar(y)
set(gca,'FontSize',8.5)
ylabel('Temperature (degrees Celsius)')
xlabel('Date')
set(gca, 'XTick',1:numel(x), 'XTickLabel',string(x))
axis tight
.
  댓글 수: 2
AAK
AAK 2021년 5월 29일
Thanks so much! :)
Star Strider
Star Strider 2021년 5월 29일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Animation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by