Force x axis to start at origin
조회 수: 12 (최근 30일)
이전 댓글 표시
Hi,
I want to make a bar chart in MATLAB R2016b. For some reason the x-axis does not start in the origin of the x- and y-axis. Does anyone know how you can force it to start there? Now it starts a couple of centimeters to the right which results in the values on the x-axis to be placed very close to each other (see figure).

This is the code I use:
b= bar(timespan,combi,'FaceColor',orange);
b(2).FaceColor= cyaan;
xlabel('Local Time [hrs]')
ylabel('# flights')
xticks(timespan)
With timespan being a matrix defining the hours of the day 0:23. And combi being a 24x2 matrix defining 2 columns of operation data.
Thanks in advance.
댓글 수: 0
채택된 답변
KSSV
2016년 11월 30일
편집: KSSV
2016년 11월 30일
Use xlim. Doc xlim.
xlim([0. 24])
댓글 수: 6
Steven Lord
2023년 11월 1일
FYI, in the years since this question was asked we've introduced a number of functions and functionality for customizing the appearance of the axes. Take a look at the functions listed on this page for more information.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Object Properties에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!