Credits Overview Plotting Styles Commands Terminals

ranges

This section describes only the optional axis ranges that may appear as the very first items in a plot or splot command. If present, these ranges override any range limits established by a previous set range statement. For optional ranges elsewhere in a plot command that limit sampling of an individual plot component, see sampling.

Syntax:

      [{<dummy-var>=}{{<min>}:{<max>}}]
      [{{<min>}:{<max>}}]

The first form applies to the independent variable (xrange or trange, if in parametric mode). The second form applies to dependent variables. <dummy-var> optionally establishes a new name for the independent variable. (The default name may be changed with set dummy.)

In non-parametric mode, ranges must be given in the order

      plot [<xrange>][<yrange>][<x2range>][<y2range>] ...

In parametric mode, ranges must be given in the order

      plot [<trange>][<xrange>][<yrange>][<x2range>][<y2range>] ...

The following plot command shows setting trange to [-pi:pi], xrange to [-1.3:1.3] and yrange to [-1:1] for the duration of the graph:

      plot [-pi:pi] [-1.3:1.3] [-1:1] sin(t),t**2

* can be used to allow autoscaling of either of min and max. Use an empty range [] as a placeholder if necessary.

Ranges specified on the plot or splot command line affect only that one graph; use the set xrange, set yrange, etc., commands to change the default ranges for future graphs.

The use of on-the-fly range specifiers in a plot command may not yield the expected result for linked axes (see set link).

For time data you must provide the range in quotes, using the same format used to read time from the datafile. See set timefmt.

Examples:

This uses the current ranges:

      plot cos(x)

This sets the x range only:

      plot [-10:30] sin(pi*x)/(pi*x)

This is the same, but uses t as the dummy-variable:

      plot [t = -10 :30]  sin(pi*t)/(pi*t)

This sets both the x and y ranges:

      plot [-pi:pi] [-3:3]  tan(x), 1/x

This sets only the y range:

      plot [ ] [-2:sin(5)*-8] sin(x)**besj0(x)

This sets xmax and ymin only:

      plot [:200] [-pi:]  $mydata using 1:2

This sets the x range for a timeseries:

      set timefmt "%d/%m/%y %H:%M"
      plot ["1/6/93 12:00":"5/6/93 12:00"] 'timedata.dat'