MATLAB Answers

Plotting leaving empty space before line begins

조회 수: 13(최근 30일)
Ian Bunker
Ian Bunker 2021년 5월 13일
편집: Cris LaPierre 2021년 5월 13일
So this plot has a gap before the beginning of the line. I have checked the arrays being inputted and they have the correct values and therefore there should be no gap.
My current theory is based on the bottom and that when the program plots the points it is rounding the axis numbers and therefore not centering the graph at the start of the line.
Any ideas on how to fix this?

채택된 답변

Cris LaPierre
Cris LaPierre 2021년 5월 13일
편집: Cris LaPierre 2021년 5월 13일
Yes, by default MATLAB will attempt to set the ticks at round numbers. If you prefer to have the limits exactly match your data, use axis tight
x = rand(1,5);
y = rand(1,5);
title('axis tight')
axis tight
  댓글 수: 1
Ian Bunker
Ian Bunker 2021년 5월 13일
Thanks! I am just glad that it is not a problem with my arrays but something that matlab does automatically.

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

추가 답변(0개)


Community Treasure Hunt

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

Start Hunting!

Translated by