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

3.15.8 ranges

The optional axis ranges at the start of a plot command specify the region of the graph that will be displayed. These override any ranges established by a previous ‘set range‘ statement.



The first form applies to the independent variable (xrange or trange, if in parametric mode). The second form applies to the dependent variable yrange (and xrange, too, if in parametric mode). <dummy-var> is a new name for the independent variable. (The defaults may be changed with dummy.) The optional <min> and <max> terms can be constant expressions or *.

In non-parametric mode, the order in which ranges must be given is xrange and yrange.

In parametric mode, the order for the ‘plot‘ command is trange, xrange, and yrange. The following ‘plot‘ command shows setting the trange to [-pi:pi], the xrange to [-1.3:1.3] and the yrange to [-1:1] for the duration of the graph:

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

Note that the x2range and y2range cannot be specified here—x2range and y2range must be used.

Ranges are interpreted in the order listed above for the appropriate mode. Once all those needed are specified, no further ones must be listed, but unneeded ones cannot be skipped—use an empty range ‘[]‘ as a placeholder.

‘*‘ can be used to allow autoscaling of either of min and max. See also autoscale.

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

With time data, you must provide the range (in the same manner as the time appears in the datafile) within quotes. ‘gnuplot‘ uses the timefmt string to read the value—see timefmt.


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, and turns off autoscaling on both axes:

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

This sets xmax and ymin only:

      plot [:200] [-pi:]  exp(sin(x))

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'

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

This document was generated on February 28, 2014 using texi2html 5.0.

© 2000-2020
Individual documents may contain additional copyright information.