필터 지우기
필터 지우기

White space at the beginning and ending of xaxis

조회 수: 48 (최근 30일)
Happy Bear
Happy Bear 2020년 7월 13일
댓글: Adam Danz 2020년 7월 13일
Hello everyone,
I made this graph but I want to have some white spacing between the yaxis and the first bin. And then I want some white spacing between the last bin and the right axis of the figure. Just like in this figure:

채택된 답변

Adam Danz
Adam Danz 2020년 7월 13일
편집: Adam Danz 2020년 7월 13일
axis(ax, 'tight') % where ax is your axis handle.
will set the axis limits so the edges of the plot touch the max and min of your data.
After running that command, you can run the lines below to add +/- 5% of your data range to each side of the x and y axes.
xlim(ax, xlim(ax) + [-1,1]*range(xlim(ax)).* 0.05)
ylim(ax, ylim(ax) + [-1,1]*range(ylim(ax)).* 0.05)
If you only want to apply this to the x-axis limits,
yl = ylim(ax);
axis(ax, 'tight')
ylim(ax, yl)
xlim(ax, xlim(ax) + [-1,1]*range(xlim(ax)).* 0.05)
  댓글 수: 4
madhan ravi
madhan ravi 2020년 7월 13일
Happy Bear 🐻 ;)
Adam Danz
Adam Danz 2020년 7월 13일
:D

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by