next up previous contents
Next: YLIM Adjust Y Limits Up: Plot Functions Previous: AXIS Plot Axis Set/Get   Contents

Subsections

XLIM Adjust X Limits of plot

Usage

There are several ways to use xlim to adjust the x limits of a plot. The y-axis retains its current limits. The four syntaxes are

   xlim([lo,hi])   
   xlim(lo,hi)
   xlim('auto')
   xlim auto

where in the first two forms, the new x-limits on the plot are [lo,hi]. In the second two forms, the axes limits are automatically selected by FreeMat.

Example

Here is an example of using xlim to zoom in on the x axis of a plot without changing the y limits. First, the plot with default limits

--> x = linspace(-1,1);
--> y = sin(2*pi*x);
--> plot(x,y,'r-');

which results in

9363

Next, we zoom in on the plot using the xlim function

--> plot(x,y,'r-')
--> xlim(-0.2,0.2)

which results in

9366


Samit K. Basu 2005-03-16