gpuguy
gpuguy

Reputation: 4585

Showing specific values on x or y axes

a=[1 2 7 5 4 6]
t=0:2:10

plot(t,a); 

enter image description here

I want that in the plot on x axis only values : 0, 2, 4, 6, 8, 10 (as per t=0:2:10 in the code) should be depicted on the time axis unlike the above which shows all values. How do I do this ?

Upvotes: 3

Views: 1760

Answers (1)

Gunther Struyf
Gunther Struyf

Reputation: 11168

Those are the xticks, set them like this:

set(gca,'Xtick',0:2:10);

If you want to hide the yticks:

set(gca,'Ytick',[]);

Upvotes: 5

Related Questions