In the first form, restore all four plot limits to extreme values, and save the previous limits in the tuple old_limits.
In the second form, set the plot limits in the current coordinate system to xmin, xmax, ymin, ymax, which may each be a number to fix the corresponding limit to a specified value, or the string "e" to make the corresponding limit take on the extreme value of the currently displayed data. Arguments may be omitted from the right end only. (But see ylimits, below, to set limits on the y-axis.)
limits() always returns a tuple of 4 doubles and an integer; old_limits[0:3] are the previous xmin, xmax, ymin, and ymax, and old_limits is a set of flags indicating extreme values and the square, nice, restrict, and log flags. This tuple can be saved and passed back to limits() in a future call to restore the limits to a previous state.
In an X window, the limits may also be adjusted interactively with the mouse. Drag left to zoom in and pan (click left to zoom in on a point without moving it), drag middle to pan, and click (and drag) right to zoom out (and pan). If you click just above or below the plot, these operations will be restricted to the x-axis; if you click just to the left or right, the operations are restricted to the y-axis. A shift-left click, drag, and release will expand the box you dragged over to fill the plot (other popular software zooms with this paradigm). If the rubber band box is not visible with shift-left zooming, try shift-middle or shift-right for alternate XOR masks. Such mouse-set limits are equivalent to a limits command specifying all four limits except that the unzoom command (see "Zooming Operations" on page 25) can revert to the limits before a series of mouse zooms and pans.
The limits you set using the limits or ylimits functions carry over to the next plot; that is, an fma operation does not reset the limits to extreme values.
The following keyword arguments can be specified with this function.
square = 0/1
If present, the square keyword determines whether limits marked as extreme values will be adjusted to force the x and y scales to be equal (square=1) or not (square=0, the default).
nice = 0/1
If present, the nice keyword determines whether limits will be adjusted to nice values (nice=1) or not (nice=0, the default).
restrict = 0/1
There is a subtlety in the meaning of "extreme value" when one or both of the limits on the OPPOSITE axis have fixed values: does the "extreme value" of the data include points which will not be plotted because their other coordinate lies outside the fixed limit on the opposite axis (restrict=0, the default), or not (restrict=1)?
Set the y-axis plot limits in the current coordinate system to ymin, ymax, which may each be a number to fix the corresponding limit to a specified value, or the string "e" to make the corresponding limit take on the extreme value of the currently displayed data.
Arguments may be omitted only from the right. Use limits( xmin, xmax ) to accomplish the same function for the x-axis plot limits.
Note that the corresponding Yorick function for ylimits is range. Since this word is a Python built-in function, the name has been changed to avoid the collision.