
How to get the x axis and y axis to start at 0 when adding regression line in Figure window
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Stephnie Watson
am 14 Mai 2021
Kommentiert: Stephnie Watson
am 14 Mai 2021
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 Kommentare
Akzeptierte Antwort
Scott MacKenzie
am 14 Mai 2021
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 Kommentare
Weitere Antworten (1)
David Fletcher
am 14 Mai 2021
Bearbeitet: David Fletcher
am 14 Mai 2021
Does the axis command do anything:
axis([0 70 0 70])
1 Kommentar
Siehe auch
Kategorien
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!