Don't want my points on the boundary
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
Alex Mcaulley
2019-4-30
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)
采纳的回答
Alex Mcaulley
2019-4-30
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 个评论
更多回答(1 个)
KSSV
2019-4-30
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])
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Formatting and Annotation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!