How can I get rid of the gap on the x-axis?

조회 수: 12 (최근 30일)
Maria Hart
Maria Hart 2021년 2월 2일
Dear all,
I have the following code which results in the shown graph. However, I would like to make the graph prettier by avoiding the gap at the end of the x-axis as well as bigger spacing between the x-ticks and x-labels. Help is much appreciated :-)
app.UIAxesThUeberschuss.XLimMode = 'auto';
app.UIAxesThUeberschuss.YLimMode = 'auto';
app.UIAxesThUeberschuss.XTick = (0:hournum:projectlengthhour); % needed to show years instead of hours
app.UIAxesThUeberschuss.XTickLabel = (0:projectlength); % needed to show years instead of hours
zoom(app.UIAxesThUeberschuss,'on');
plot(app.UIAxesThUeberschuss,1:projectlengthhour,P_ueber.th);
Info:
  • hournum = 8760
  • projectlength = 30
  • projectlengthhour = 262800 (=hournum * projectlength)
  • P_ueber.th is a 262800x1 vector
  댓글 수: 5
Walter Roberson
Walter Roberson 2021년 2월 2일
Manual is configured automatically if you use xlim(). You would xlim() passing in the min() and max() of the x data, which often would correspond to the first and last x values.
Maria Hart
Maria Hart 2021년 2월 2일
Nice, I tried
app.UIAxesPV_ungeordnet.XLim = [0 projectlengthhour];
and it worked. Thanks!

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

답변 (1개)

Constantino Carlos Reyes-Aldasoro
How about
axis tight
would that work?

카테고리

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