There are several ways to use ylim
to adjust the y limits of
a plot. The x-axis retains its current limits. The four
syntaxes are
ylim([lo,hi]) ylim(lo,hi) ylim('auto') ylim auto
where in the first two forms, the new y-limits on the plot are
[lo,hi]
. In the second two forms, the axes limits are
automatically selected by FreeMat.
Here is an example of using ylim
to zoom in on the y axis of a
plot without changing the x limits. First, the plot with default
limits
--> x = linspace(-1,1); --> y = sin(2*pi*x); --> plot(x,y,'r-');
which results in
Next, we zoom in on the plot using the ylim
function
--> plot(x,y,'r-') --> ylim(-0.2,0.2)
which results in