How to get the x axis and y axis to start at 0 when adding regression line in Figure window
9 次查看(过去 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?
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';
3 个评论
Scott MacKenzie
2021-5-14
In that case, look for the XAxisLocation property in the Property Inspector and set it to "origin".
更多回答(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 中查找有关 Bar Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!