Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change axis limits and tick step of a MatLab figure?

I have a simple plot of y against x.

y = [6,-1.3,-8,-11.7,-11,-6,1.3,8,11.7,11,6,-1.3];
x = 0:0.3:3.3;
plot (x,y)

As the result, the x-axis of the figure is ranging from 0 to 3.5, with scale of 0.5. I have used the XLimit = [0 3.3] to limit the axis, but it seems like not working.

I wish to make the x-axis range from 0 to 3.3 with steps of 0.3.

like image 388
Jeff Pang Avatar asked Feb 06 '23 23:02

Jeff Pang


1 Answers

axis tight % removes the empty space after 3.3
set(gca,'XTick',0:0.3:3.3) % sets the x axis ticks
like image 148
AVK Avatar answered Feb 08 '23 16:02

AVK