![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/618113/image.jpeg)
How to get the x axis and y axis to start at 0 when adding regression line in Figure window
조회 수: 11 (최근 30일)
이전 댓글 표시
How do I edit the graph to get the x and y axis at 0 to line up at 0 instead of the way it is spaced?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/618093/image.jpeg)
댓글 수: 0
채택된 답변
Scott MacKenzie
2021년 5월 14일
I'm assuming you don't want to loose the points with y < 0. Something like this should work...
% test data
x = 1:100;
y = linspace(1,60) + randi([-5 5], 1, 100);
p = scatter(x, y, 'filled');
lsline;
ax = gca;
ax.YLim = [-10 70];
ax.XAxisLocation = 'origin';
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/618113/image.jpeg)
댓글 수: 3
Scott MacKenzie
2021년 5월 14일
In that case, look for the XAxisLocation property in the Property Inspector and set it to "origin".
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/618373/image.jpeg)
추가 답변 (1개)
David Fletcher
2021년 5월 14일
편집: David Fletcher
2021년 5월 14일
Does the axis command do anything:
axis([0 70 0 70])
참고 항목
카테고리
Help Center 및 File Exchange에서 Visual Exploration에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!