Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Showing specific values on x or y axes

Tags:

plot

matlab

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 ?

like image 619
gpuguy Avatar asked Dec 13 '25 08:12

gpuguy


1 Answers

Those are the xticks, set them like this:

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

If you want to hide the yticks:

set(gca,'Ytick',[]);
like image 158
Gunther Struyf Avatar answered Dec 15 '25 08:12

Gunther Struyf