Don't want my points on the boundary
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
David Epstein
el 30 de Abr. de 2019
Comentada: Alex Mcaulley
el 30 de Abr. de 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 comentarios
Alex Mcaulley
el 30 de Abr. de 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)
Respuesta aceptada
Alex Mcaulley
el 30 de Abr. de 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 comentario
Alex Mcaulley
el 30 de Abr. de 2019
Probably you had any definition as:
xlim = [-3,3]
Más respuestas (1)
KSSV
el 30 de Abr. de 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 comentarios
Ver también
Categorías
Más información sobre Formatting and Annotation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!