4.3 Choosing which Data to Plot

As well as the plot command’s index, using and every modifiers, which allow users to plot subsets of data from data files, it also has a further modifier, select. This can be used to plot only those data points in a data file which specify some given criterion. For example:

plot 'data.dat' select ($8>5)
plot sin(x) select (($1>0) and ($2>0))

In the second example, two selection criteria are given, combined with the logical and operator. A full list of all of the operators recognised by PyXPlot, including logical operators, was given in Chapter 2; see Table 2.3. The select modifier has many applications, for example, plotting two-dimensional slices of three-dimensional datasets and plotting subsets of data from files.

When plotting using the lines style, the default behaviour is for the lines plotted not to be broken if a set of datapoints are removed by the select modifier. However, this behaviour is sometimes undesirable. To cause the plotted line to break when points are removed the discontinuous modifier is supplied. For example:

plot sin(x) select ($1>0) discontinuous

plots a set of disconnected peaks from the sine function.