manpagez: man pages & more
info gnuplot
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.24.91 xrange

The 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} }
                 | restore
      show xrange

where <min> and <max> 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 timefmt format. Any value omitted will not be changed.

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

The ‘reverse‘ option reverses the direction of the axis, e.g., ‘set xrange [0:1] reverse‘ will produce an axis with 1 on the left and 0 on the right. This is identical to the axis produced by ‘set xrange [1:0]‘, of course. ‘reverse‘ is intended primarily for use with autoscale.

The ‘writeback‘ option essentially saves the range found by autoscale in the buffers that would be filled by 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 yrange after each command in the above example should help you understand what is going on.

In 2-d, 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 3-d, xrange, yrange, and zrange govern the axes and urange and vrange govern the parametric variables.

In polar mode, rrange determines the radial range plotted. <rmin> acts as an additive constant to the radius, whereas <rmax> acts as a clip to the radius—no point with radius greater than <rmax> 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‘.

Examples:

To set the xrange to the default:

      set xrange [-10:10]

To set the yrange to increase downwards:

      set yrange [10:-10]

To change zmax to 10 without affecting zmin (which may still be autoscaled):

      set zrange [:10]

To autoscale xmin while leaving xmax unchanged:

      set xrange [*:]


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on November 19, 2011 using texi2html 5.0.