Xrange

The set xrange command sets the horizontal range that will be displayed. A similar command exists for each of the other axes, as well as for the polar radius r and the parametric variables t, u, and v.

Syntax:

     set xrange [{{<min>}:{<max>}}] {{no}reverse} {{no}writeback} {{no}extend}
                | restore
     show xrange

where 4#4min5#5 and 4#4max5#5 terms are constants, expressions or an asterisk to set autoscaling. If the data are time/date, you must give the range as a quoted string according to the set timefmt format. If 4#4min5#5 or 4#4max5#5 is omitted the current value will not be changed. See below for full autoscaling syntax. See also noextend (p. [*]).

The same syntax applies to yrange, zrange, x2range, y2range, cbrange, rrange, trange, urange and vrange.

See set link (p. [*]) for options that link the ranges of x and x2, or y and y2.

The reverse option reverses the direction of an autoscaled axis. For example, if the data values range from 10 to 100, it will autoscale to the equivalent of set xrange [100:10]. The reverse flag has no effect if the axis is not autoscaled. NB: This is a change introduced in version 4.7.

Autoscaling: If 4#4min5#5 (the same applies for correspondingly to 4#4max5#5) is an asterisk "*" autoscaling is turned on. The range in which autoscaling is being performed may be limited by a lower bound 4#4lb5#5 or an upper bound 4#4ub5#5 or both. The syntax is

     { <lb> < } * { < <ub> }
For example,
     0 < * < 200
sets 4#4lb5#5 = 0 and 4#4ub5#5 = 200. With such a setting 4#4min5#5 would be autoscaled, but its final value will be between 0 and 200 (both inclusive despite the '4#4' sign). If no lower or upper bound is specified, the '4#4' to also be omitted. If 4#4ub5#5 is lower than 4#4lb5#5 the constraints will be turned off and full autoscaling will happen. This feature is useful to plot measured data with autoscaling but providing a limit on the range, to clip outliers, or to guarantee a minimum range that will be displayed even if the data would not need such a big range.

The writeback option essentially saves the range found by autoscale in the buffers that would be filled by set xrange. This is useful if you wish to plot several functions together but have the range determined by only some of them. The writeback operation is performed during the plot execution, so it must be specified before that command. To restore, the last saved horizontal range use set xrange restore. For example,

     set xrange [-10:10]
     set yrange [] writeback
     plot sin(x)
     set yrange restore
     replot x/2

results in a yrange of [-1:1] as found only from the range of sin(x); the [-5:5] range of x/2 is ignored. Executing show yrange after each command in the above example should help you understand what is going on.

In 2D, xrange and yrange determine the extent of the axes, trange determines the range of the parametric variable in parametric mode or the range of the angle in polar mode. Similarly in parametric 3D, xrange, yrange, and zrange govern the axes and urange and vrange govern the parametric variables.

In polar mode, rrange determines the radial range plotted. 4#4rmin5#5 acts as an additive constant to the radius, whereas 4#4rmax5#5 acts as a clip to the radius — no point with radius greater than 4#4rmax5#5 will be plotted. xrange and yrange are affected — the ranges can be set as if the graph was of r(t)-rmin, with rmin added to all the labels.

Any range may be partially or totally autoscaled, although it may not make sense to autoscale a parametric variable unless it is plotted with data.

Ranges may also be specified on the plot command line. A range given on the plot line will be used for that single plot command; a range given by a set command will be used for all subsequent plots that do not specify their own ranges. The same holds true for splot.


Subsections