Don't want my points on the boundary
    5 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
    David Epstein
      
 le 30 Avr 2019
  
    
    
    
    
    Commenté : Alex Mcaulley
      
 le 30 Avr 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 commentaires
  Alex Mcaulley
      
 le 30 Avr 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)

Réponse acceptée
  Alex Mcaulley
      
 le 30 Avr 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 commentaire
  Alex Mcaulley
      
 le 30 Avr 2019
				Probably you had any definition as:
xlim = [-3,3]
Plus de réponses (1)
  KSSV
      
      
 le 30 Avr 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 commentaires
Voir également
Catégories
				En savoir plus sur Logical dans Help Center et File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


