Credits | Overview | Plotting Styles | Commands | Terminals
--- | --- | --- | --- | ---

## 1D sampling (x or t axis)

By default, computed functions are sampled over the entire range of the plot as set by a prior set xrange command, by an x-axis range specifier at the very start of the plot command, or by autoscaling the xrange to span data seen in all the elements of this plot. Points generated by the pseudo-file "+" are sampled over the current range of the t axis, which may or may not be the same as the range of the x axis.

Individual plot components can be assigned a more restricted sampling range.

Examples:

This establishes a total range on x running from 0 to 1000 and then plots data from a file and two functions each spanning a portion of the total range:

          set xrange [0:1000]
          plot 'datafile', [0:200] func1(x), [200:500] func2(x)

This is similar except that the total range is established by the contents of the data file. In this case the sampled functions may or may not be entirely contained in the plot:

          set autoscale x
          plot 'datafile', [0:200] func1(x), [200:500] func2(x)

The plot command below is ambiguous. The initial range [0:10] will be interpreted as applying to the entire plot, overriding the previous xrange command, rather than applying solely to the sampling of the first function as was probably the intent:

          set xrange [0:50]
          plot [0:10] f(x), [10:20] g(x), [20:30] h(x)

To remove the ambiguity in the previous example, insert the keyword sample to indicate that [0:10] is a sampling range applied to a single plot component rather than a global x-axis range that would apply to the entire plot.

          plot sample [0:10] f(x), [10:20] g(x), [20:30] h(x)

This example shows one way of tracing out a helix in a 3D plot

          set xrange [-2:2]; set yrange [-2:2]
          splot sample [h=1:10] '+' using (cos(h)):(sin(h)):(h)