Don't want my points on the boundary
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
David Epstein
am 30 Apr. 2019
Kommentiert: Alex Mcaulley
am 30 Apr. 2019
This code puts my points on the boundary of the plot , which
I don't want. Have tried setting xlim large, and various
other approaches. Any enlargement would help.
close all;
s = 2;
ss = -s:s;
[x,y] = meshgrid(ss);
plot(x,y,'ko');
hold on;
xticks([-s-1:s+1])
4 Kommentare
Alex Mcaulley
am 30 Apr. 2019
This code should work:
s = 2;
ss = -s:s;
[x,y] = meshgrid(ss);
plot(x,y,'ko');
hold on;
xlim([-3,3])
ylim([-3,3])
xticks(ss)
yticks(ss)
Akzeptierte Antwort
Alex Mcaulley
am 30 Apr. 2019
Here we are:
s = 2;
ss = -s:s;
[x,y] = meshgrid(ss);
plot(x,y,'ko');
hold on;
xlim([-3,3])
ylim([-3,3])
xticks(ss)
yticks(ss)
1 Kommentar
Alex Mcaulley
am 30 Apr. 2019
Probably you had any definition as:
xlim = [-3,3]
Weitere Antworten (1)
KSSV
am 30 Apr. 2019
s = 2;
dx = 0.5 ; % can be changed to your desired offset
ss = -s+dx:s-dx;
[x,y] = meshgrid(ss);
plot(x,y,'ko');
hold on;
xticks([-s-1:s+1])
2 Kommentare
Siehe auch
Kategorien
Mehr zu Formatting and Annotation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!